I'm trying to fail LongPressGesture with maximumDistance when I move my finger away from the Image but that doesn't work, it keeps printing the message "Pressed"
struct ContentView: View {
@GestureState private var isDetectingPress = false
var body: some View {
Image(systemName: "trash")
.resizable().aspectRatio(contentMode: .fit)
.frame(width: 100, height: 100)
.scaleEffect(isDetectingPress ? 0.5 : 1)
.animation(.easeInOut(duration: 0.2))
.gesture(LongPressGesture(minimumDuration: 0.01, maximumDistance: 10).sequenced(before:DragGesture(minimumDistance: 0).onEnded {_ in
print("Pressed")
})
.updating($isDetectingPress) { value, state, _ in
switch value {
case .second(true, nil):
state = true
default:
break
}
})
}
}