---
title: "performKeyEquivalent(with:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsresponder/performkeyequivalent(with:)"
---

# performKeyEquivalent(with:)

Handle a key equivalent.

## Declaration

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

## Parameters

- `event`: An event object that represents the key equivalent pressed.

## Discussion

Discussion Override to handle key equivalents. If the character code or codes in event match the receiver’s key equivalent, the receiver should respond to the event and return true. The default implementation does nothing and returns false. note: performKeyEquivalent(with:) takes an NSEvent object as its argument, while performMnemonic: takes an NSString object containing the uninterpreted characters of the key event. You should extract the characters for a key equivalent using the NSEvent method  charactersIgnoringModifiers.

## See Also

### Related Documentation

- [performKeyEquivalent(with:)](appkit/nsview/performkeyequivalent(with:).md)
- [performKeyEquivalent(with:)](appkit/nsbutton/performkeyequivalent(with:).md)

### Responding to Key Events

- [keyDown(with:)](appkit/nsresponder/keydown(with:).md)
- [keyUp(with:)](appkit/nsresponder/keyup(with:).md)
- [interpretKeyEvents(_:)](appkit/nsresponder/interpretkeyevents(_:).md)
- [flushBufferedKeyEvents()](appkit/nsresponder/flushbufferedkeyevents().md)
