I have a View that performs two different actions depending if a vertical or horizontal scroll is recognized. I'm using a DragGesture for this. This view (let's call it MyView) takes a ViewBuilder in its initializer and can be nested, meaning that I can have MyView wrapped into MyView.
Now, as // 1. MyView is a container to // 2. MyView, if I drag inside this second MyView vertically, even if it will just perform some actions when horizontally, it's still recognizing the touch and preventing the first MyView to react to this touch.
So my question is: following a SwiftUI approach, is there any way to use a DragGesture and fail recognition of the gesture as you'd do in UIKit and that way propagate the touch to let other gestures recognize that touch? Is there any alternative?
Code Block // 1. MyView { VStack { Text("This one is vertical") // 2. MyView { Text("This one is horizontal") } .layout(.horizontal) // listens to horizontal drags } } .layout(.vertical) // listens to vertical drags
Now, as // 1. MyView is a container to // 2. MyView, if I drag inside this second MyView vertically, even if it will just perform some actions when horizontally, it's still recognizing the touch and preventing the first MyView to react to this touch.
So my question is: following a SwiftUI approach, is there any way to use a DragGesture and fail recognition of the gesture as you'd do in UIKit and that way propagate the touch to let other gestures recognize that touch? Is there any alternative?