<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGestureRecognizer/canBePrevented(by:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGestureRecognizer(im)canBePreventedByGestureRecognizer:"
  },
  "title" : "canBePrevented(by:)"
}
-->

# canBePrevented(by:)

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

```
func canBePrevented(by preventingGestureRecognizer: UIGestureRecognizer) -> Bool
```

## Parameters

`preventingGestureRecognizer`

An instance of a subclass of `UIGestureRecognizer`.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> to indicate that `preventingGestureRecognizer` can block the receiver from recognizing its gesture, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)