Toast stack
Notifications that enter with a spring, reflow around a dismissal, and cancel their lifetime tasks when removed.

Real SwiftUI, captured on an iPhone 17 Pro simulator. Run the native gallery
Installation
Install the native Swift CLI, then add the component to your app.
hugsy add toast-stack
Prefer to copy it yourself? Open the complete Swift file and add it to your iOS app target in Xcode. No package dependency is required.
Usage
@State private var toasts = HugsyToasts()
HugsyToastStack(toasts: toasts)
Button("Save") {
toasts.show("Changes saved", duration: .seconds(5))
}
Keep a HugsyToasts instance in @State and overlay HugsyToastStack inside your safe area. At most four notifications remain visible. Each mounted row owns its timeout task, which is cancelled when that row disappears.
API reference
| Parameter | Type & behavior | Default |
|---|---|---|
toasts | HugsyToastsKeep this main-actor observable model in @State. | Required |
show(_:symbol:duration:) | HugsyToasts methodAdds a toast at the front, keeping at most four. The symbol defaults to checkmark.circle.fill. | 5 seconds |
dismiss(_:) | (UUID) -> VoidRemoves the matching notification. Repeated dismissal is safe. | None |
Interaction
Add a notification, then dismiss one from the stack. New notifications expire independently.
Accessibility
Each notification has a labeled dismiss button. Reduce Motion uses opacity rather than sliding transitions. Keep important errors in persistent screen content instead of relying on a timed toast.
Test with VoiceOver, Dynamic Type, and Reduce Motion on a physical device before shipping. The gallery demonstrates the interaction, not every application-specific content state.