<!--
{
  "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(item:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE11actionSheet4item7contentQrAA7BindingVyqd__SgG_AA06ActionE0Vqd__XEts12IdentifiableRd__lF"
  },
  "title" : "actionSheet(item:content:)"
}
-->

# actionSheet(item:content:)

Presents an action sheet using the given item as a data source for the
sheet’s content.

```
nonisolated func actionSheet<T>(item: Binding<T?>, content: (T) -> ActionSheet) -> some View where T : Identifiable
```

## Parameters

`item`

A binding to an optional source of truth for the action
sheet. When `item` is non-`nil`, the system passes
the contents to the modifier’s closure. You use this content
to populate the fields of an action sheet that you create that the
system displays to the user. If `item` changes, the system
dismisses the currently displayed action sheet and replaces it
with a new one using the same process.

`content`

A closure returning the [`ActionSheet`](/documentation/SwiftUI/ActionSheet) you create.

## Discussion

Use this method when you need to populate the fields of an action sheet
with content from a data source. The example below shows a custom data
source, `FileDetails`, that provides data to populate the action sheet:

```
struct FileDetails: Identifiable {
    var id: String { name }
    let name: String
    let fileType: UTType
}
struct ConfirmFileImport: View {
    @State private var sheetDetail: FileDetails?
    var body: some View {
        Button("Show Action Sheet") {
            sheetDetail = FileDetails(name: "MyImageFile.png",
                                      fileType: .png)
        }
        .actionSheet(item: $sheetDetail) { detail in
            ActionSheet(
                title: Text("File Import"),
                message: Text("""
                         Import \(detail.name)?
                         File Type: \(detail.fileType.description)
                         """),
                buttons: [
                    .destructive(Text("Import"),
                                 action: importFile),
                    .cancel()
                ])
        }
    }

    func importFile() {
        // Handle import action.
    }
}
```

![A screenshot showing an action sheet populated using a custom data source that describes a file and file format.](images/com.apple.SwiftUI/SwiftUI-View-ActionSheetItemContent@2x.png)

---

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)