Input cancellation - SwiftUI

In SwiftUI, you should avoid performing actions in response to gestures in onChanged or updating methods because users will not be able to cancel their interaction. Actions should only be activated through onEnded method.

When implementing gestures, use SwiftUI's built-in gestures that have support for cancellation upon touchUp events.

Text("Appt")
    .gesture(LongPressGesture()
        .onChanged { _ in
            // Avoid activating actions before user has finished or cancelled touch
        }
        .onEnded { _ in
            // Activate action when the touch event is finished
        })