<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/dialogSuppressionToggle(isSuppressed:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE23dialogSuppressionToggle12isSuppressedQrAA7BindingVySbG_tF"
  },
  "title" : "dialogSuppressionToggle(isSuppressed:)"
}
-->

# dialogSuppressionToggle(isSuppressed:)

Enables user suppression of dialogs and alerts presented within `self`,
with a default suppression message on macOS. Unused on other platforms.

```
nonisolated func dialogSuppressionToggle(isSuppressed: Binding<Bool>) -> some View
```

## Parameters

`isSuppressed`

Whether the suppression toggle is on or off
in the dialog.

## Discussion

Applying dialog suppression adds a toggle to dialogs on macOS,
which allows the user to request the alert not be displayed again.
Typically whether a dialog is suppressed is stored in `AppStorage`
and used to decide whether to present the dialog in the future.

The following example configures a `confirmationDialog` with a
suppression toggle. The toggle’s state is stored in `AppStorage` and
used to determine whether or not to show the dialog when the
“Delete Items” button is pressed.

```
struct ConfirmEraseItems: View {
    @State private var isShowingDialog = false

    @AppStorage("suppressEraseItemAlert")
    private var suppressAlert = false

    var body: some View {
        Button("Delete Items") {
            if !suppressAlert {
                isShowingDialog = true
            } else {
                // Handle item deletion.
            }
        }
        .confirmationDialog(
            "Are you sure you want to erase these items?",
            isPresented: $isShowingDialog
        ) {
            Button("Erase", role: .destructive) {
                // Handle item deletion.
            }
            Button("Cancel", role: .cancel) {
                isShowingDialog = false
            }
        }
        .dialogSuppressionToggle(isSuppressed: $suppressAlert)
    }
}
```

---

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)