Haptics · 19 free pieces

SwiftUI components with haptic feedback

Every piece here fires haptics at the moment that matters: a threshold crossed, a detent reached, an action confirmed or refused.

All components

About these pieces

One self-contained Swift file each, Apple frameworks only, from iOS 17.

Haptics make a control feel physical, but only when they are sparing and exact. These pieces use sensoryFeedback (iOS 17) to mark real events: a selection tick as a slider steps, a heavier detent every five seconds on Timer Dial, rising taps as Hold to Confirm passes its milestones, and a solid impact when Swipe Deck throws a card.

Each piece's notes say which feedback fires when, so you can keep the pattern consistent across your own screens.

Learn the technique: SwiftUI haptics guide, SwiftUI buttons guide.

Questions

How the pieces work, and how to build the same thing yourself. Every piece's page has its full notes.

How do I add haptic feedback in SwiftUI?

On iOS 17 and later, attach .sensoryFeedback(.selection, trigger: value) to a view; the feedback plays whenever the trigger value changes. For earlier versions, use UIImpactFeedbackGenerator or UISelectionFeedbackGenerator.

Which haptic should I use?

Selection for stepping through values, impact for physical events like a snap or a throw, success, warning and error for outcomes. Keep them rare enough that each one means something.

Next

Ready to build something better?

55 pieces, one file each, yours to keep. Start with the library or see what the whole app looks like.