Class

UIAlertAction

An action that can be taken when the user taps a button in an alert.

Overview

You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button. After creating an alert action object, add it to a UIAlertController object before displaying the corresponding alert to the user.

Topics

Creating an Alert Action

init(title: String?, style: UIAlertActionStyle, handler: ((UIAlertAction) -> Void)? = nil)

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

Getting the Action’s Attributes

var title: String?

The title of the action’s button.

var style: UIAlertActionStyle

The style that is applied to the action’s button.

var isEnabled: Bool

A Boolean value indicating whether the action is currently enabled.

Constants

enum UIAlertActionStyle

Styles to apply to action buttons in an alert.

Relationships

Inherits From

See Also

Alerts

class UIAlertController

An object that displays an alert message to the user.