Question: In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes.

When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that default 'doonk' sound that happens when you press a key somewhere you shouldn't.

Is there any way to indicate that the keystroke *was* handled and accepted, and that I don't need a beep to tell the user it wasn't?

Answer: 
I think (but am not 100% certain, it's been a bit of time since I did this) you also need to override the `NSView` and/or `NSResponder` [`performKeyEquivalent:`](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/performKeyEquivalent%3a) method. There, you'll return a `YES` to indicate to the caller that you did indeed handle the event.

And that will keep the "dooonk" sound from happening.
In my case `performKeyEquivalent` did not capture the Enter key. The beep was triggered in the `keyDown` event. This Swift code prevents beeping when handling the Enter key:

```
override func keyDown(with event: NSEvent) {
    if event.keyCode != 36 {
        super.keyDown(with: event)
    }
}

override func keyUp(with event: NSEvent) {
    if event.keyCode == 36 {
        // Do your thing
    }
}

```