I am writing a Swift Application in xCode and have no problem creating a new menuitem and wiring it up so that the sent action responds to a function in my ViewController. Where I am having difficulty is if I try to override one of the existing Apple, preset menu actions. For example, I would like to display my own help so I want to override the showHelp: function that is currently the action set for the help menu.
This what I did. Remember, I am using a storyboard and this worked for new menu items.
- Selected the Attributes inspector for the FirstResponder of the MainMenu.xib
- Added a new action showMyHelp: and I left the type as id
- Created a new function called showMyHelp() in my ViewController
- Selected the myApplicationName help menuitem from the main menu and then from the connections panel, dragged from Sent Actions to the first responder of the MainMenu and selected showMyHelp from the selection list. The Sent Actions now reads action > First Responder / showMyHelp:
However, when I run the app, the help menu is now disabled and I cannot access it.
Again, if i repeat this method for one of my custom menuItems that I have added, it works fine. The menuItem is not disabled and the action is performed.