---
title: "init(title:action:modifierFlags:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uicommandalternate/init(title:action:modifierflags:)"
---

# init(title:action:modifierFlags:)

Creates a command alternative with the specified title, action, and modifier flags.

## Declaration

```swift
convenience init(title: String, action: Selector, modifierFlags: UIKeyModifierFlags)
```

## Parameters

- `title`: The command alternative’s title.
- `action`: The action to take after a person selects the alternative command.
- `modifierFlags`: The bit mask of modifier keys that a person must press. You can use this parameter to specify which modifier keys (Command, Option, and so on) a person must also press. You may specify more than one modifier key. For a list of possible values, see doc://com.apple.uikit/documentation/UIKit/UIKeyModifierFlags.

## Return Value

Return Value A command alternative object.

## See Also

### Creating a command alternative

- [init(coder:)](uikit/uicommandalternate/init(coder:).md)
