Skip to content
B.Cem edited this page Sep 3, 2026 · 3 revisions

PeekDialog

Toast and banner notifications for SwiftUI — same binding-based API as .sheet and .alert. Drop in any view as content, auto-dismiss or swipe away, style it however you want.

On iOS, dialogs live in their own overlay window so they sit above sheets, alerts, and the rest of your UI. Multiple notifications can stack into a queue.

PeekDialog demo


What you get

Familiar API isPresented: and with: bindings, just like Apple's presentation modifiers
Any content Text, buttons, images, custom layouts — it's just a SwiftUI view
Auto-dismiss .short / .medium / .long / .custom(seconds:) / .persistent
Swipe to dismiss On by default; turn it off with .peekInteractiveDismissDisabled()
Styles .plain for full control, glass styles on iOS 26+, or roll your own DialogStyle
Stacking (iOS) peekDialog(items:) queues notifications; top two stay visible
Over everything (iOS) Window-based presentation above sheets and alerts

Quick start

import SwiftUI
import PeekDialog

struct ContentView: View {
    @State private var showDialog = false

    var body: some View {
        Button("Show") { showDialog = true }
            .peekDialog(isPresented: $showDialog, dismissDelay: .medium) {
                HStack {
                    Image(systemName: "checkmark.circle.fill")
                        .foregroundColor(.green)
                    Text("Saved")
                    Spacer()
                }
                .padding()
            }
    }
}

That's it. Bind state → describe content → PeekDialog handles the rest.

Gotcha: .dialogStyle, .peekInteractiveDismissDisabled, and .peekPlacementInset must go inside the content closure. Putting them on the view that has .peekDialog does nothing. See Common Mistakes.


Guides

Guide What's in it
Installation SPM / Xcode setup
Getting Started Boolean & optional bindings, dismissal, onDismiss
Duration and Placement Delay presets, top / center / bottom placement, and .peekPlacementInset
Swipe to Dismiss Enabling / disabling drag-to-dismiss
Stacking Queued notifications with peekDialog(items:) (iOS)
Styling Built-in styles and .plain
Custom Styles Writing your own DialogStyle
Common Mistakes Preference keys outside the closure, and other traps

Platforms

Platform Presentation Stacking
iOS Overlay window (above sheets) Yes — peekDialog(items:)
macOS / watchOS / visionOS In-hierarchy overlay Single dialog only

Links

Clone this wiki locally