Instance Method


Creates a dependency relationship between the receiver and another gesture recognizer when the objects are created.


func require(toFail otherGestureRecognizer: UIGestureRecognizer)



Another gesture-recognizer object (an instance of a subclass of UIGestureRecognizer).


This method works fine when gesture recognizers aren’t created elsewhere in the app—or in a framework—and the set of gesture recognizers remains the same. If you need to set up failure requirements lazily or in different view hierarchies, use gestureRecognizer(_:shouldRequireFailureOf:) and gestureRecognizer(_:shouldBeRequiredToFailBy:) instead. (Note that the shouldRequireFailure(of:) and shouldBeRequiredToFail(by:) methods let subclasses define class-wide failure requirements.)

This method creates a relationship with another gesture recognizer that delays the receiver’s transition out of UIGestureRecognizer.State.possible. The state that the receiver transitions to depends on what happens with otherGestureRecognizer:

An example where this method might be called is when you want a single-tap gesture require that a double-tap gesture fail.

See Also