0

In my NSViewController I placed a print(_:) method, but it's not being called when I hit print. Instead, the print is being captured by the current NSTextField that I'm in. How do I force the print call to go into the view controller? I defined it like so:

@objc func print(sender: AnyObject) { 
}
Gargoyle
  • 9,590
  • 16
  • 80
  • 145
  • You can change the action and/or target of the menu item. – Willeke Apr 03 '16 at 12:01
  • Can you provide a bit more info please? I'm brand new to Cocoa and the responder chain (I'm an iOS guy normally) – Gargoyle Apr 03 '16 at 16:29
  • Menu items are like buttons. You can connect them to an action and a target in the XIB. Change the name of your print method and connect the menu item the first responder and this method. – Willeke Apr 03 '16 at 20:53

0 Answers0