Instance Method


Causes the application to send the action message of a specified menu item to its target.


func performActionForItem(at index: Int)



The integer index of a menu item.


If a target is not specified, the message is sent to the first responder. As a side effect, this method posts willSendActionNotification and didSendActionNotification.

In macOS 10.6 and later the performActionForItemAtIndex: no longer triggers menu validation. This is because validation is typically done during menu tracking or key equivalent matching, so the subsequent performActionForItemAtIndex: validation was redundant. To trigger validation explicitly, use invoke the update() method.

In OS X v10.6 performActionForItemAtIndex:, when called, now triggers highlighting in the menu bar. It also sends out appropriate accessibility notifications indicating the item was selected.

See Also