I'm trying to sequence two LongPressGestures, but my onEnded handler isn't being called when the second one finishes. Here is my code:
This gesture manipulates a timer. The point of the gesture is to ensure that the user must long press for at least 0.5 seconds before they may lift their finger in order to start the timer. In other words, there is a 500ms long "confirmation" period where the user must hold down their finger before they can actually complete the gesture. Doing a simple tap will cancel the gesture during cautionary.
Here's what I'm trying to accomplish:
Code Block swift var timerGesture: some Gesture { let cautionary = LongPressGesture(minimumDuration: 0.5) .onEnded { _ in print("cautionary done") } let lift = LongPressGesture(minimumDuration: .infinity) .onEnded { _ in print("lift done") } return cautionary.sequenced(before: lift) }
This gesture manipulates a timer. The point of the gesture is to ensure that the user must long press for at least 0.5 seconds before they may lift their finger in order to start the timer. In other words, there is a 500ms long "confirmation" period where the user must hold down their finger before they can actually complete the gesture. Doing a simple tap will cancel the gesture during cautionary.
Here's what I'm trying to accomplish:
User long presses for at least 0.5 seconds. After 0.5 seconds, cautionary's onEnded is called.
The user releases their finger, and lift's onEnded is called.