One Logo Pool Ball
SwiftUI · IOS API REFERENCE

DismissBehavior

struct · iOS 17.0+ · SDK 27.1

struct DismissBehavior

Programmatic window dismissal behaviors. Use values of this type to control window dismissal during the current transaction. For example, to dismiss windows showing a modal presentation that would otherwise prohibit dismissal, use the ``destructive`` behavior: struct DismissWindowButton: View { @Environment(\.dismissWindow) private var dismissWindow var body: some View { Button("Close Auxiliary Window") { withTransaction(\.dismissBehavior, .destructive) { dismissWindow(id: "auxiliary") } } } }

Members (2)

get · iOS 17.0+

destructive

TypeScript
static get destructive(): DismissBehavior
Swift declaration
static let destructive: DismissBehavior

The destructive dismiss behavior. Use this behavior when you want to dismiss a window regardless of any conditions that would normally prevent the dismissal. Dismissing windows in this matter may result in loss of state. On macOS, this behavior will cause windows to dismiss even when they are currently showing a modal presentation, such as a sheet or alert. Additionally, a document window will not show the save dialog when there are unsaved changes and the window is dismissed with this behavior. On iOS, this behavior behaves the same as `interactive`.

get · iOS 17.0+

interactive

TypeScript
static get interactive(): DismissBehavior
Swift declaration
static let interactive: DismissBehavior

The interactive dismiss behavior. Use this behavior when you want to dismiss a window in a manner that is similar to the standard system affordances for window dismissal - for example, when a user clicks the close button. This is the default behavior on macOS and iOS. On macOS, dismissing a window using this behavior will not dismiss a window which is currently showing a modal presentation, such as a sheet or alert. Additionally, a document window that is dismissed with this behavior will show the save dialog if there are unsaved changes to the document. On iOS, dismissing a window using this behavior will dismiss it regardless of any modal presentations being shown.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →