init(title:image:identifier:options:children:)
Creates a new menu with the specified values.
Declaration
@MainActor @preconcurrency convenience init(title: String = "", image: UIImage? = nil, identifier: UIMenu.Identifier? = nil, options: UIMenu.Options = [], children: [UIMenuElement] = [])Parameters
- title:
The title of the menu.
- image:
The image to display next to the menu’s title.
- identifier:
The unique identifier for the menu. When creating standard menus for your app, specify an appropriate constant defined in Identifier Swift.struct. For custom menus, specify a custom reverse domain name value, or specify
nilto let this method create a unique identifier for you. - options:
Additional configuration options for the menu. For a list of possible values, see Options Swift.struct.
- children:
The menu elements in the menu. Specify leaf menu elements using Uimenuelement subclasses like Uiaction, Uicommand, or Uikeycommand, and specify submenus using Uimenu objects. You may specify an empty array if the menu has no child menu elements.