<!--
{
  "availability" : [
    "iOS: 13.0.0 - 27.0.0",
    "iPadOS: 13.0.0 - 27.0.0",
    "macCatalyst: 13.0.0 - 27.0.0",
    "tvOS: 13.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 6.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/actionSheet(isPresented:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE11actionSheet11isPresented7contentQrAA7BindingVySbG_AA06ActionE0VyXEtF"
  },
  "title" : "actionSheet(isPresented:content:)"
}
-->

# actionSheet(isPresented:content:)

Presents an action sheet when a given condition is true.

```
nonisolated func actionSheet(isPresented: Binding<Bool>, content: () -> ActionSheet) -> some View
```

## Parameters

`isPresented`

A binding to a Boolean value that determines whether
to present the action sheet that you create in the modifier’s
`content` closure. When the user presses or taps the sheet’s default
action button the system sets this value to `false` dismissing
the sheet.

`content`

A closure returning the `ActionSheet` to present.

## Discussion

In the example below, a button conditionally presents an action sheet
depending upon the value of a bound Boolean variable. When the Boolean
value is set to `true`, the system displays an action sheet with both
destructive and default actions:

```
struct ConfirmEraseItems: View {
    @State private var isShowingSheet = false
    var body: some View {
        Button("Show Action Sheet", action: {
            isShowingSheet = true
        })
        .actionSheet(isPresented: $isShowingSheet) {
            ActionSheet(
                title: Text("Permanently erase the items in the Trash?"),
                message: Text("You can't undo this action."),
                buttons:[
                    .destructive(Text("Empty Trash"),
                                 action: emptyTrashAction),
                    .cancel()
                ]
            )}
    }

    func emptyTrashAction() {
        // Handle empty trash action.
    }
}
```

![An action sheet with a title and message showing the use of default and destructive button types.](images/com.apple.SwiftUI/SwiftUI-View-ActionSheetisPresentedContent@2x.png)

> Note: In regular size classes in iOS, the system renders alert sheets
> as a popover that the user dismisses by tapping anywhere outside the
> popover, rather than displaying the default dismiss button.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)