the "funk" sound when hitting escape key in app

Viewed 321

hello when I make an app in Xcode I always get the "funk" noise when I hit escape key https://imgur.com/a/AehZC

it doesn't happen in regular Mac OS apps unless I'm hitting escape in en empty textfield

but in Xcode built app it does it whenever I'm in the app and I hit escape

is there a way to override something and prevent that noise

    super.keyDown(with: event)

maybe something that has to do with this

1 Answers

Add a new file, cocoa class to your project, click next, create a CustomView class, subclass of NSView (language Swift). Override the method performKeyEquivalent and add return event.keyCode == 53. Then select your window view in your IB, go to the identity inspector and change the custom class to CustomView:

import Cocoa

class CustomView: NSView {
    override func performKeyEquivalent(with event: NSEvent) -> Bool {
        return event.keyCode == 53
    }
}
Related