Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.29 KB

File metadata and controls

56 lines (41 loc) · 1.29 KB

ToastKit

A polished, dependency-free SwiftUI toast and snackbar library with queueing, semantic styles, gestures, and first-class accessibility.

Overview

ToastKit presents short, transient messages — toasts — over your SwiftUI hierarchy. Toasts are plain values, presentation is driven by an observable ToastCenter that queues them FIFO and shows one at a time, and rendering is installed with a single SwiftUICore/View/toastKit(center:) modifier at the root of your app.

@main struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            RootView()
                .toastKit()
        }
    }
}

// Anywhere on the main actor:
ToastCenter.shared.present(.success("Saved"))
ToastCenter.shared.present(.error("Upload failed", title: "Network"))

Toasts animate in with a spring move-and-fade (a plain crossfade when Reduce Motion is on), can be swiped away toward their edge, support tap actions, and announce themselves to VoiceOver on iOS.

Topics

Essentials

  • doc:GettingStarted
  • Toast
  • ToastCenter
  • SwiftUICore/View/toastKit(center:)

Styling

  • doc:Theming
  • ToastStyle
  • ToastShadow

Presentation

  • ToastView

Timing and testability

  • ToastScheduling
  • ToastScheduledTask
  • TaskToastScheduler