What problem does it solve?
SwiftUI gesture handling often becomes fragile when gestures need to compose correctly, manage transient state, and avoid parent/child conflicts, leading to inconsistent touch behavior.
Core Features & Use Cases
- Modern gesture APIs for iOS 17+: Use
MagnifyGesture and RotateGesture instead of deprecated variants for pinch/rotate interactions.
- Correct gesture composition: Compose gestures with
.simultaneously(with:), .sequenced(before:), and .exclusively(before:) to model real multi-gesture UX.
- Transient state done right: Use
@GestureState and .updating() to provide responsive UI feedback that automatically resets.
- Priority and conflict resolution: Fix swallowed taps and competing interactions via
.gesture(), .highPriorityGesture(), .simultaneousGesture(), and GestureMask.
- Reusable custom gestures: Create
Gesture-conforming types and ergonomic View extensions for consistent interaction patterns.
- Performance-aware gesture handling: Keep
onChanged lightweight and defer expensive work to onEnded to avoid stutter.
Quick Start
Apply the swiftui-gestures guidance to your SwiftUI view by choosing the correct gesture type(s), wiring transient feedback with @GestureState and .updating(), and resolving any parent/child conflicts using the appropriate gesture composition or priority modifier.