AurumToastHost

Aurum's toast host — a thin overlay slot that renders the single currently visible AurumToast from hostState with slide-up/fade enter/exit animation, and drives auto-dismiss via AurumToastDuration.

familyFeedback
platformiOS 17+ · SwiftUI
sourceSources/Aurum/Component/Feedback/AurumToastHost.swift

Aurum's toast host — a thin overlay slot that renders the single currently visible AurumToast from hostState with slide-up/fade enter/exit animation, and drives auto-dismiss via AurumToastDuration.

Place at the bottom of the screen, typically bottom-aligned in an overlay: .overlay(alignment: .bottom) { AurumToastHost(hostState: toastHost) }. Hoist AurumToastHostState with @State and trigger via Task { await hostState.showToast("Saved") }.

This is codebase-only — there is no Figma equivalent. It is orchestration glue, not a visual primitive. The visual is AurumToast.

Intended use

Host slot for all in-app, programmatic notifications: confirmations, validation feedback, sync results, retry prompts. One host per screen, bottom-anchored. Replaces ad-hoc alert/overlay improvisations in feature code.

Do

  • Trigger from handlers via Task { await hostState.showToast(...) } — the call suspends until the toast resolves, which is what serialises the queue.
  • Place the host inside the same container that owns the screen's bottom safe-area inset — the host doesn't pad insets itself.
  • Use .short for confirmations, .long for messages that need reading, .indefinite for actions awaiting an explicit dismiss.

Don’t

  • Render an AurumToast outside a host when the message is programmatic / asynchronous — without the queue + timer you'll either drop messages or stack them.
  • Mount more than one AurumToastHost per screen — concurrent hosts fight for the bottom slot and produce racy overlays.
  • Give the host a fixed height or .frame(maxHeight: .infinity) — it occupies only the toast's natural height; anchor it with .overlay(alignment: .bottom) instead.