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

# gestureRecognizer(_:shouldRequireFailureOf:)

Asks the delegate if the current gesture recognizer must wait to recognize its gesture until the specified gesture recognizer fails.

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

## Parameters

`gestureRecognizer`

The gesture recognizer that might need to wait to recognize its gesture. This is the object with which the delegate is associated.

`otherGestureRecognizer`

The gesture recognizer that must fail before the object in `gestureRecognizer` can recognize its gesture.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if `otherGestureRecognizer` must fail before `gestureRecognizer` 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)