Search code examples
swiftcocoansmenuitem

How to add a selector to a menu item when using storyboard


I know how to do it programatically, creating a menu and adding menu items and then assigning selector to it and eventually calling a function. But what i am not able to figure out is how do i execute a function when an NSMenuItem was added using Story Board. enter image description here

All i want to do is when i click on "New ITEM" a function is called on the current controller.

Can you please suggest or point me to an example?


Solution

  • Drag out a Sent Action from the Connections inspector.

    enter image description here