Contents

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

Creates an action with the specified title, image, identifier, discoverability title, attributes, state, and handler.

Declaration

@MainActor @preconcurrency 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 to invoke after a person selects the action. This handler has the following parameter:

    action

    The action that a person selects.

See Also

Creating an action