---
title: "addAction(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uialertcontroller/addaction(_:)"
---

# addAction(_:)

Attaches an action object to the alert or action sheet.

## Declaration

```swift
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

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

- [actions](uikit/uialertcontroller/actions.md)
- [preferredAction](uikit/uialertcontroller/preferredaction.md)
