What problem does it solve?
This Skill helps developers implement, review, and improve gesture handling in SwiftUI applications, ensuring modern and robust user interactions.
Core Features & Use Cases
- Gesture Implementation: Add tap, long press, drag, magnify, and rotate gestures.
- Gesture Composition: Combine gestures using
.simultaneously, .sequenced, and .exclusively.
- State Management: Utilize
@GestureState for transient gesture states and @State for persistent ones.
- Conflict Resolution: Manage parent/child gesture conflicts with
.highPriorityGesture and .simultaneousGesture.
- Custom Gestures: Build custom gestures by conforming to the
Gesture protocol.
- Use Case: Implement a complex image manipulation interface where users can simultaneously pinch to zoom and rotate an image, with smooth animations and intuitive state management.
Quick Start
Implement a drag gesture on a view that updates its position using @GestureState and persists the final offset using @State.