So I have a ScrollView holding a set of views:
ScrollView {
ForEach(cities) { city in
NavigationLink(destination: ...) {
I have created an easy to use extension based on the Michel's answer.
struct NoButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
}
}
extension View {
func delayTouches() -> some View {
Button(action: {}) {
highPriorityGesture(TapGesture())
}
.buttonStyle(NoButtonStyle())
}
}
You apply it after using a drag gesture.
Example:
ScrollView {
YourView()
.gesture(DragGesture(minimumDistance: 0)
.onChanged { _ in }
.onEnded { _ in }
)
.delayTouches()
}