Subject: SwiftUI Gesture Conflict in iOS 18: Simultaneous Recognition of Drag and Tap Gestures
Description:
In SwiftUI on iOS 18 and above, we've identified an issue with gesture handling that affects user experience. When implementing .simultaneousGesture(DragGesture())
, the system incorrectly recognizes and processes both drag and tap gestures concurrently, resulting in unintended behavior.
Technical Details:
- Environment: SwiftUI, iOS 18+
- Issue: Simultaneous recognition of horizontal drag gestures and vertical scroll/tap gestures
- Current Behavior: Both vertical and horizontal scrolling occur simultaneously when using
.simultaneousGesture(DragGesture())
- Expected Behavior: Gestures should be properly disambiguated to prevent concurrent scrolling in multiple directions
Impact: This behavior significantly impacts user experience, particularly in custom carousel implementations and other UI components that rely on precise gesture handling. The simultaneous recognition of both gestures creates a confusing and unpredictable interaction pattern.
Steps to Reproduce:
- Create a SwiftUI view with horizontal scrolling (e.g., custom carousel)
- Implement
.simultaneousGesture(DragGesture())
- Add tap gesture recognition to child views
- Run on iOS 18
- Attempt to scroll horizontally
Observed Result: Both horizontal dragging and vertical scrolling/tapping are recognized and processed simultaneously, creating an inconsistent user experience.
Expected Result: The system should properly disambiguate between horizontal drag gestures and vertical scroll/tap gestures, allowing only one type of gesture to be recognized at a time based on the user's intent.
Please let me know if you need any additional information or reproduction steps.