Contents

addItem(_:)

Adds a menu item to the end of the menu.

Declaration

func addItem(_ newItem: NSMenuItem)

Parameters

  • newItem:

    The menu item (an object conforming to the NSMenuItem protocol) to add to the menu.

Discussion

This method invokes insertItem(_:at:). Thus, the menu does not accept the menu item if it already belongs to another menu. After adding the menu item, the menu updates itself.

See Also

Adding and Removing Menu Items