A container for grouping related menu items in an app menu or contextual menu.


class UIMenu : UIMenuElement


Create UIMenu objects and use them to construct the menus and submenus your app displays. You provide menus for your app when it runs on macOS, and key command items in those menus also appear in the discoverability HUD on iPad when the user presses the command key. You also use menus to display contextual actions in response to specific interactions with one of your views. Every menu has a title, an optional image, and an optional set of child items. When the user selects an item from the menu, UIKit executes the code that you provide.


Creating a Menu Object

struct UIMenu.Identifier

Constants for identifying an app's standard menus.

Accessing the Child Elements

var children: [UIMenuElement]

The contents of the menu.

func replacingChildren([UIMenuElement]) -> UIMenu

Creates a new menu with the same configuration as the current menu, but with a new set of child elements.

Getting the Menu Details

var identifier: UIMenu.Identifier

The unique identifier for the current menu.

var options: UIMenu.Options

The configuration options for the current menu.

struct UIMenu.Options

Constants for configuring a menu's appearance.


Inherits From

Conforms To

See Also

App Menus

class UIMenuElement

An object representing a menu or menu item.


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software