I'm trying to add a drag gesture over a vertically scrollable view like List (mainly to detect horizontal drag only). I want the drag gesture to work in higher priority than the scrollable view scrolling behavior. On iOS 17 or prior, the below code works, however on iOS 18 beta, I'm facing that the scrollable view becomes unscrollable.
I found a similar topic in the developer forum as well. https://forums.developer.apple.com/forums/thread/760551
This is the minimum reproducible example:
struct ContentView: View {
var body: some View {
List {
ForEach(0..<100) {
Text("\($0)")
}
}
.highPriorityGesture(
DragGesture()
.onChanged({ value in
print("onChanged \(value)")
})
.onEnded({ value in
print("onEnded \(value)")
})
)
}
}
Any workaround?
GeometryReader
in the background of a list section. – Grannia