Contents

canPrevent(_:)

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

Declaration

func canPrevent(_ preventedGestureRecognizer: UIGestureRecognizer) -> Bool

Parameters

  • preventedGestureRecognizer:

    An instance of a subclass of UIGestureRecognizer.

Return Value

true to indicate that the receiver can block preventedGestureRecognizer from recognizing its gesture, otherwise false.

Discussion

Overriding these methods enables the same behavior as implementing the UIGestureRecognizerDelegate methods gestureRecognizerShouldBegin(_:) and gestureRecognizer(_:shouldReceive:). However, by overriding them, subclasses can define class-wide prevention rules. For example, a UITapGestureRecognizer object never prevents another UITapGestureRecognizer object with a higher tap count.

See Also

Implementing subclasses