init(title:image:action:propertyList:alternates:discoverabilityTitle:attributes:state:)
Creates a command with the specified title, image, action, property list, alternative commands, discoverability title, attributes, and state.
Declaration
@MainActor @preconcurrency convenience init(title: String = "", image: UIImage? = nil, action: Selector, propertyList: Any? = nil, alternates: [UICommandAlternate] = [], discoverabilityTitle: String? = nil, attributes: UIMenuElement.Attributes = [], state: UIMenuElement.State = .off)Parameters
- title:
The title to display for the command.
- image:
The image to display next to the command’s title. Only the Context menu system supports the display of an image, and only when the app is running in iOS.
- action:
The action to take after a person user selects the command.
- propertyList:
An object that contains data to associate with the command.
- alternates:
An array of alternatives for the command.
- discoverabilityTitle:
An elaborated title that explains the purpose of the command.
- attributes:
The attributes indicating the style of the command.
- state:
The initial state of the command.