---
title: "init(title:subtitle:image:identifier:discoverabilityTitle:attributes:state:handler:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uiaction/init(title:subtitle:image:identifier:discoverabilitytitle:attributes:state:handler:)"
---

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

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

## Declaration

```swift
@MainActor @preconcurrency convenience init(title: String = "", subtitle: String? = nil, 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.
- `subtitle`: The subtitle to display alongside the action’s title.
- `image`: The image to display next to the action’s title. Only the doc://com.apple.uikit/documentation/UIKit/UIMenuSystem/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:

## See Also

### Creating an action

- [init(title:image:identifier:discoverabilityTitle:attributes:state:handler:)](uikit/uiaction/init(title:image:identifier:discoverabilitytitle:attributes:state:handler:).md)
- [captureTextFromCamera(responder:identifier:)](uikit/uiaction/capturetextfromcamera(responder:identifier:).md)
- [UIAction.Identifier](uikit/uiaction/identifier-swift.struct.md)
- [UIActionHandler](uikit/uiactionhandler.md)
