I want to detect when the user stopped touching the screen. But I want it to be in a vertical ScrollView and a DragGesture isn't recognized when the view is scrolled vertically. I'm guessing this is because there wasn't anything dragged, since the view moved along with the user's finger.
import SwiftUI
struct TestView: View {
var body: some View {
ScrollView {
VStack(spacing: 0) {
Rectangle()
.foregroundStyle(.green)
.frame(height: 700)
}
}
.gesture(DragGesture().onEnded({ _ in print("Drag gesture ended") }))
}
}
How should I go about detecting when the user lifted their finger off the screen on a scrollview?
3
0
1.9k