Came here with the same question and you were so close! At least in 2026 on Xcode 27 Beta, don't have older versions handy.
All you need to do is swap the .gesture() modifier with .simultaneousGesture():
struct TestView: View {
var body: some View {
ScrollView {
VStack(spacing: 0) {
Rectangle()
.foregroundStyle(.green)
.frame(height: 700)
}
}
.simultaneousGesture(DragGesture().onEnded({ _ in print("Drag gesture ended") }))
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: