<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSGestureRecognizerDelegate/gestureRecognizer(_:shouldBeRequiredToFailBy:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSGestureRecognizerDelegate(im)gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:"
  },
  "title" : "gestureRecognizer(_:shouldBeRequiredToFailBy:)"
}
-->

# gestureRecognizer(_:shouldBeRequiredToFailBy:)

Asks the delegate if the current gesture recognizer must fail before another gesture recognizer is allowed to recognize its gesture.

```
@MainActor optional func gestureRecognizer(_ gestureRecognizer: NSGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: NSGestureRecognizer) -> Bool
```

## Parameters

`gestureRecognizer`

The gesture recognizer that must fail before `otherGestureRecognizer` can recognize its gesture. This is the object with which the delegate is associated.

`otherGestureRecognizer`

The gesture recognizer that might need to wait to recognize its gesture.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if `gestureRecognizer` must fail before `otherGestureRecognizer` is allowed to recognize its gesture. If you do not implement this method, the default return value is <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method is called once per attempt to recognize, so you can change the failure requirements dynamically. The two gesture recognizers do not have to belong to the same view hierarchy.

Returning <doc://com.apple.documentation/documentation/Swift/true> is guaranteed to set up the failure requirement; returning <doc://com.apple.documentation/documentation/Swift/false> does not prevent the failure requirement from being set up by the other gesture recognizer.

---

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)