<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIAlertAction/init(title:style:handler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIAlertAction(cm)actionWithTitle:style:handler:"
  },
  "title" : "init(title:style:handler:)"
}
-->

# init(title:style:handler:)

Create and return an action with the specified title and behavior.

```
convenience init(title: String?, style: UIAlertAction.Style, handler: ((UIAlertAction) -> Void)? = nil)
```

## Parameters

`title`

The text to use for the button title. The value you specify should be localized for the user’s current language. This parameter must not be `nil`, except in a tvOS app where a `nil` title may be used with [`UIAlertAction.Style.cancel`](/documentation/UIKit/UIAlertAction/Style-swift.enum/cancel).

`style`

Additional styling information to apply to the button. Use the style information to convey the type of action that is performed by the button. For a list of possible values, see the constants in [`UIAlertAction.Style`](/documentation/UIKit/UIAlertAction/Style-swift.enum).

`handler`

A block to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter.

## Return Value

A new alert action object.

## Discussion

Actions are enabled by default when you create them.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)