Implement, review, or improve SwiftUI gesture handling. Use when adding tap, long press, drag, magnify, or rotate gestures, composing gestures with simultaneously/sequenced/exclusively, managing transient state with @GestureState, resolving parent/child gesture conflicts with highPriorityGesture or simultaneousGesture, building custom Gesture protocol conformances, or migrating from deprecated MagnificationGesture to MagnifyGesture or using the newer RotateGesture.
This skill provides comprehensive guidance for implementing, reviewing, and improving SwiftUI gesture handling in iOS applications targeting iOS 26 and above. It addresses the common challenges developers face when working with touch interactions, including recognizing taps, long presses, drags, pinch-to-zoom, and rotation gestures. The skill ensures developers use modern gesture APIs correctly, avoid deprecated patterns, and handle complex gesture interactions with proper state management and conflict resolution.
The skill covers all major SwiftUI gesture types including TapGesture for single and multi-tap detection, LongPressGesture for press-and-hold interactions, DragGesture for tracking finger movement, and the modern MagnifyGesture and RotateGesture (iOS 17+) that replace older deprecated APIs. It provides detailed guidance on gesture composition techniques using simultaneously, sequenced, and exclusively modifiers, as well as transient state management with @GestureState for visual feedback during gesture recognition. The skill also addresses parent-child gesture conflicts through highPriorityGesture and simultaneousGesture modifiers.
This skill is essential for iOS developers building interactive SwiftUI applications, particularly those working on photo editing apps, drawing tools, gaming interfaces, or any application requiring sophisticated touch interactions. It's especially valuable when migrating legacy code from deprecated gesture APIs to modern Swift 6.3 patterns, building custom gesture recognizers conforming to the Gesture protocol, or debugging gesture conflicts in complex view hierarchies. The skill includes a review checklist and common mistakes section to help ensure robust, maintainable gesture implementations.
Discrete gestures like TapGesture and LongPressGesture fire once when recognized and only support .onEnded callbacks. Continuous gestures like DragGesture, MagnifyGesture, and RotateGesture stream updates throughout the interaction and support .onChanged, .onEnded, and .updating callbacks for real-time feedback.
MagnificationGesture is deprecated in modern iOS versions. MagnifyGesture (iOS 17+) is the recommended replacement that provides the same pinch-to-zoom functionality with improved API design and better integration with Swift 6.3 patterns.
@GestureState is designed for transient state that should automatically reset when the gesture ends, making it ideal for visual feedback during gestures. Use @State for persistent state that should remain after the gesture completes, such as final positions or accumulated transformations.
Use highPriorityGesture on the child view to make it respond first, or use simultaneousGesture to allow both parent and child gestures to recognize simultaneously. The gesture composition modifiers (simultaneously, sequenced, exclusively) provide fine-grained control over how multiple gestures interact.
This skill targets iOS 26+ with Swift 6.3 patterns, though most gestures are available from iOS 13+. MagnifyGesture and RotateGesture specifically require iOS 17+. Always check the compatibility table in the skill documentation for specific gesture requirements.
Quick Setup:
.claude/skills/Repository
dpearson2699/swift-ios-skills