Initializer

init(title:image:identifier:discoverabilityTitle:attributes:state:handler:)

Creates an action.

Declaration

convenience init(title: String, image: UIImage? = nil, identifier: UIAction.Identifier? = nil, discoverabilityTitle: String? = nil, attributes: UIMenuElement.Attributes = [], state: UIMenuElement.State = .off, handler: @escaping UIActionHandler)

Parameters

title

The title to display for the action.

image

The image to display next to the action's title. Only the context menu system supports the display of an image, and only when the app is running in iOS.

identifier

The unique identifier for the action. Specify nil to let this method create a unique identifier for you.

discoverabilityTitle

An elaborated title that explains the purpose of the action.

attributes

The attributes indicating the style of the action.

state

The initial state of the action.

handler

The handler invoked after the user selects the action. This handler has the following parameter:

action

The action selected by the user.

See Also

Creating an Action

struct UIAction.Identifier

A type that represents an action identifier.

typealias UIActionHandler

A type that defines the closure for an action handler.