---
title: "init(title:style:handler:)"
framework: watchkit
role: symbol
role_heading: Initializer
path: "watchkit/wkalertaction/init(title:style:handler:)"
---

# init(title:style:handler:)

Creates and returns an action object with the specified button information.

## Declaration

```swift
convenience init(title: String, style: WKAlertActionStyle, handler: @escaping WKAlertActionHandler)
```

## Parameters

- `title`: The localized string to use as the button title for the action.
- `style`: The style to apply to the action button. For a list of possible styles and their meanings, see doc://com.apple.watchkit/documentation/WatchKit/WKAlertActionStyle.
- `handler`: A block containing the code to execute when the user taps the action button. Use this block to perform whatever action is required to perform the associated task. For information about the format of this block, see doc://com.apple.watchkit/documentation/WatchKit/WKAlertActionHandler.

## Return Value

Return Value An initialized action object that you can display in an alert.

## Discussion

Discussion Use this method to create a button to display in an action sheet. In an action sheet, specifying an action with the WKAlertActionStyle.cancel style replaces the standard Cancel button provided by the system.
