Contents

canBePrevented(by:)

Overridden to indicate that the specified gesture recognizer can prevent the current object from recognizing a gesture.

Declaration

func canBePrevented(by preventingGestureRecognizer: NSGestureRecognizer) -> Bool

Parameters

  • preventingGestureRecognizer:

    The gesture recognizer that can prevent the current object from recognizing its gesture.

Return Value

true to indicate that preventingGestureRecognizer can block the current gesture recognizer from recognizing its gesture, or false if both gesture recognizers can operate simultaneously.

Discussion

This method enables similar behavior as the gestureRecognizerShouldBegin(_:) and gestureRecognizer(_:shouldRequireFailureOf:) methods of the gesture recognizer’s delegate. Using this method lets you define rules that apply to all instances of your custom gesture recognizer class. For example, a gesture recognizer of a given class might want to prevent instances of the same class from recognizing at the same time.

See Also

Methods for Subclasses