---
title: "init(title:image:action:propertyList:alternates:discoverabilityTitle:attributes:state:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uicommand/init(title:image:action:propertylist:alternates:discoverabilitytitle:attributes:state:)"
---

# 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

```swift
@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 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.
- `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.

## See Also

### Creating a command

- [init(title:subtitle:image:action:propertyList:alternates:discoverabilityTitle:attributes:state:)](uikit/uicommand/init(title:subtitle:image:action:propertylist:alternates:discoverabilitytitle:attributes:state:).md)
- [init(coder:)](uikit/uicommand/init(coder:).md)
- [Adding menus and shortcuts to the menu bar and user interface](uikit/adding-menus-and-shortcuts-to-the-menu-bar-and-user-interface.md)
