Contents

addAction(_:)

Attaches an action object to the alert or action sheet.

Declaration

func addAction(_ action: UIAlertAction)

Parameters

  • action:

    The action object to display as part of the alert. Actions are displayed as buttons in the alert. The action object provides the button text and the action to be performed when that button is tapped.

Discussion

If your alert has multiple actions, the order in which you add those actions determines their order in the resulting alert or action sheet.

See Also

Configuring the user actions