Contents

canPrevent(_:)

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

Declaration

func canPrevent(_ preventedGestureRecognizer: NSGestureRecognizer) -> Bool

Parameters

  • preventedGestureRecognizer:

    The gesture recognizer to be prevented from recognizing its gesture.

Return Value

true to indicate that preventedGestureRecognizer should be blocked 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, an NSClickGestureRecognizer object does not prevent another NSClickGestureRecognizer object with a higher click count from recognizing its gesture.

See Also

Methods for Subclasses