Cancel key event in Swift

here is the thing.
I’ve a Swift application with a NSTextField. The user can edit the text inside and validate the change by typing the “enter” key on his keyboard.
However, the enter key is already used for an other action in my software.

How could I bypass my shortcut action for only validate the text?

  • UITableview: How to Disable Selection for Some Rows but Not Others
  • Swift performance using NSXMLParser
  • Defining a constant in objective-c
  • Adding “using namespace…” causes compilation error in xcode 4
  • Embedded Content Contains Swift Code with Xcode 8 Beta
  • Why is there an NSInteger?
  • I thought about using a flag regarding in which even we are but it’s not the most elegant solution I think…


    The architecture is the following. The NSTextField is in a file and the other action comes from an other ViewController. The action is mad using the storyboard.
    So the NSTextField cannot communicate easily (i.e without a lot of couplage) withe the action in the view controller.