Skip to main content
Logo Appt Light

Input cancellation on iOS

Users should be able to cancel accidental interaction. For example, when users accidentally touches the wrong button, they should be able to undo this and avoid performing an action. Accidental interaction is more common for people with various disabilities.

On iOS, you should avoid using touchesBegan or UIControlEventTouchDown because users will not be able to cancel their interaction. Actions should only be activated through up events. Use a UITapGestureRecognizer instead, because it has built-in support for cancellation.

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    // Use UITapGestureRecognizer instead
}

Feedback?

Let us know!