Class

CPAlertAction

An action displayed on an alert as a button.

Declaration

class CPAlertAction : NSObject

Overview

Use an alert action to display a button on an alert. The combination of the alert and action styles determine the appearance of the action button. To perform an action after the user taps the button, provide a block to the action’s handler property.

Topics

Creating an Alert Action

init(title: String, style: CPAlertAction.Style, handler: CPAlertActionHandler)

Creates an alert action with a title, style, and action handler.

Getting the Title

var title: String

The action button's title.

Getting the Action Style

var style: CPAlertAction.Style

The display style for the action button.

enum CPAlertAction.Style

Display styles for an alert’s action button.

Getting the Action Handler

var handler: CPAlertActionHandler

The block invoked after the user taps the action button.

typealias CPAlertActionHandler

The declaration for an alert action handler.

Relationships

Inherits From

See Also

Action Sheets and Alerts

class CPActionSheetTemplate

A template for displaying an action sheet on the CarPlay screen.

class CPAlertTemplate

A template for displaying alerts on the CarPlay screen.