-
-
Notifications
You must be signed in to change notification settings - Fork 0
Swipe to Dismiss
B.Cem edited this page Jul 28, 2026
·
1 revision
By default a dialog can be dragged away. Past a small threshold it dismisses; a shorter drag springs back.
Apply peekInteractiveDismissDisabled() inside the content closure (same place as .dialogStyle). Mirrors Apple's interactiveDismissDisabled on sheets.
.peekDialog(isPresented: $showDialog, dismissDelay: .long) {
HStack {
Text("You have a new message")
Spacer()
Button("View") { /* ... */ }
}
.padding()
.peekInteractiveDismissDisabled()
}When disabled, the dialog only leaves via dismissDelay or clearing the binding. Buttons and auto-dismiss still work — only the swipe gesture is off.
Toggle from state:
.peekInteractiveDismissDisabled(isLocked)Like .dialogStyle, this must sit on the content inside peekDialog. Outside the closure it is ignored — Common Mistakes.
← Getting Started · Home