Sheets · 5 free pieces

SwiftUI sheets and toasts

The moments that ask or tell: a confirmation sheet, a pre-permission sheet, a toast with an undo action and a timer that pauses while touched, and a spotlight tour for first-run tips.

All components

About these pieces

One self-contained Swift file each, Apple frameworks only, from iOS 17.

Confirm Sheet presents as a height-fitted bottom sheet or as an inline card you can drag away, with a loading primary action that lands on a success check before dismissing and a warning haptic for destructive choices. Permission Sheet explains a permission before the system prompt, spins while the system asks, and routes the button to Settings if the answer is no.

Toast is a single toast card with a kind tile, an optional detail line, an Undo-style action and a thin timer that pauses while touched, placed inside the safe area so it clears the Dynamic Island and rides above the keyboard.

Spotlight Tour introduces a screen one control at a time: it dims everything else through a cutout that springs from stop to stop with a red ring, places a callout with step progress above or below the target, lets taps through to the real control, and can show itself only once.

Learn the technique: SwiftUI haptics guide.

Questions

How the pieces work, and how to build the same thing yourself. Every piece's page has its full notes.

How do I show a toast in SwiftUI?

SwiftUI has no toast API. Overlay a view at the top or bottom of your root view, drive it from state, and dismiss it on a timer that pauses while touched. Toast does this with an action button and haptics.

How do I build an onboarding coach mark tour in SwiftUI?

Mark each control you want to point at, collect their frames at the screen's root, and draw a dimmed overlay with a cutout around the current one and a callout beside it. Spotlight Tour does this with .spotlightAnchor and .spotlightTour, including VoiceOver focus, Reduce Motion and a show-once option.

How do I make a bottom sheet that fits its content in SwiftUI?

Measure the content height and pass it to presentationDetents([.height(h)]). Confirm Sheet does the measurement for you.

Ready to build something better?

85 pieces, one file each, yours to keep. Start with the library or see what the whole app looks like.