SwiftToasts is a lightweight, interactive toast notification library for SwiftUI that provides an elegant way to display temporary messages in iOS applications.
Represents an individual toast notification with the following properties:
id
: Unique identifier for each toastcontent
: The view content of the toastoffsetX
: Horizontal offset for swipe interactionsisDeleting
: Flag indicating deletion state
- Simple Toast
Toast.simple("Notification Text", systemImage: "checkmark.circle")
- Custom Toast
Toast { id in
// Custom toast content
}
Check Demo.swift
- Swipe-to-dismiss gesture
- Expandable toast view
- Stacked notification layout
- Smooth animations
- iOS 17+ visual effects support
- Compact mode: Stacked, overlapping toasts
- Expanded mode: Full list of toasts
- Horizontal swipe left to dismiss
- Tap to expand/collapse toast stack
- Supports iOS 16+
- Optimized for iOS 17 with additional visual effects
Add the Swift file to your project or integrate via Swift Package Manager.