A representation of an action sheet presentation.
Use an action sheet when you want the user to make a choice between two
or more options, in response to their own action. If you want the user to
act in response to the state of the app or the system, rather than a user
action, use an ``Alert`` instead.
You show an action sheet by using the
``View/actionSheet(isPresented:content:)`` view modifier to create an
action sheet, which then appears whenever the bound `isPresented` value is
`true`. The `content` closure you provide to this modifier produces a
customized instance of the `ActionSheet` type. To supply the options, create
instances of ``ActionSheet/Button`` to distinguish between ordinary options,
destructive options, and cancellation of the user's original action.
The action sheet handles its own dismissal by setting the bound
`isPresented` value back to `false` when the user taps a button in the
action sheet.
The following example creates an action sheet with three options: a Cancel
button, a destructive button, and a default button. The second and third of
these call methods are named `overwriteWorkout` and `appendWorkout`,
respectively.
@State private var showActionSheet = false
var body: some View {
Button("Tap to show action sheet") {
showActionSheet = true
}
.actionSheet(isPresented: $showActionSheet) {
ActionSheet(title: Text("Resume Workout Recording"),
message: Text("Choose a destination for workout data"),
buttons: [
.cancel(),
.destructive(
Text("Overwrite Current Workout"),
action: overwriteWorkout
),
.default(
Text("Append to Current Workout"),
action: appendWorkout
)
]
)
}
}
The system may interpret the order of items as they appear in the `buttons`
array to accommodate platform conventions. In this example, the Cancel
button is the first member of the array, but the action sheet puts it in its
standard position at the bottom of the sheet.

Creates an action sheet with the provided buttons.
- Parameters:
- title: The title of the action sheet.
- message: The message to display in the body of the action sheet.
- buttons: The buttons to show in the action sheet.