Skip to main content

Connecting Menu Items to IBActions in a Mac Storyboard

·1 min

A common pattern in Mac application development is to create a menu item, create an IBAction for that item in one of your classes, and connect the menu item to the IBAction. When the person running your application chooses that menu item, your application performs the IBAction.

If you’re using storyboards to develop your Mac application, you’re probably placing your IBActions in your view controllers. When trying to connect a menu item to an IBAction, your first instinct is to make a connection from the menu item to the view controller containing the IBAction. But if you make the connection, you’ll see the following HUD:

ActionSegueHUD

That’s not what you were expecting to see. How do you connect the menu item so you can wire up your IBAction? Make the connection from the menu item to the application scene’s First Responder.

ApplicationSceneFirstResponder

When you make the connection to the application scene’s First Responder, the HUD will show a long list of actions instead of segues. Your IBActions should appear in that list.