Set Up the Menu Item

Open MainWindowController.swift and, near the bottom of the definition of MainWindowController, add a new section Actions and a stub for an @IBAction.

 ​ ​ ​ ​/​/​ ​M​A​R​K​:​ ​-​ ​A​c​t​i​o​n​s​

 ​ ​ ​ ​@​I​B​A​c​t​i​o​n​ ​f​u​n​c​ ​s​h​o​w​D​i​e​C​o​n​f​i​g​u​r​a​t​i​o​n​(​s​e​n​d​e​r​:​ ​A​n​y​O​b​j​e​c​t​?​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​p​r​i​n​t​l​n​(​"​C​o​n​f​i​g​u​r​a​t​i​o​n​ ​m​e​n​u​ ​i​t​e​m​ ​c​l​i​c​k​e​d​"​)​
 ​ ​ ​ ​}

Open MainMenu.xib and add a menu item to the main menu for your application by dragging it out of the object library (Figure 24.3).

Figure 24.3  Adding a menu item

Adding a menu item

Change the title ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.