<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/performKeyEquivalent(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)performKeyEquivalent:"
  },
  "title" : "performKeyEquivalent(with:)"
}
-->

# performKeyEquivalent(with:)

Implemented by subclasses to respond to key equivalents (also known as keyboard shortcuts).

```
func performKeyEquivalent(with event: NSEvent) -> Bool
```

## Parameters

`event`

The key-down event object representing a key equivalent.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if `theEvent` is a key equivalent that the view handled, <doc://com.apple.documentation/documentation/Swift/false> if it is not a key equivalent that it should handle.

## Discussion

If the view’s key equivalent is the same as the characters of the key-down event `theEvent`, as returned by [`charactersIgnoringModifiers`](/documentation/AppKit/NSEvent/charactersIgnoringModifiers), the view should take the appropriate action and return <doc://com.apple.documentation/documentation/Swift/true>. Otherwise, it should return the result of invoking `super`‘s implementation. The default implementation of this method simply passes the message down the view hierarchy (from superviews to subviews) and returns <doc://com.apple.documentation/documentation/Swift/false> if none of the view’s subviews responds <doc://com.apple.documentation/documentation/Swift/true>.

---

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)