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

# performKeyEquivalent(with:)

Looks for a cell that has the given key equivalent and, if found, makes that cell respond as if clicked.

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

## Parameters

`event`

The event containing the character for which to find a key equivalent.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if a cell in the receiver responds to the key equivalent in `theEvent`, <doc://com.apple.documentation/documentation/Swift/false> if no cell responds.

## Discussion

If there’s a cell in the receiver that has a key equivalent equal to the character in [`theEvent```NSEvent/charactersIgnoringModifiers``] (taking into account any key modifier flags) and that cell is enabled, that cell is made to react as if the user had clicked it: by highlighting, changing its state as appropriate, sending its action if it has one, and then unhighlighting.

Your code should never send this message—it is sent when the receiver or one of its superviews is the first responder and the user presses a key. You may want to override this method to change the way key equivalents are performed or displayed or to disable them in your subclass.

---

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)