DismissBehavior
Programmatic window dismissal behaviors.
Declaration
struct DismissBehaviorOverview
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")
}
}
}
}