c2p-cmd/SwiftToasts
A simple Toast Library for SwiftUI
Overview
SwiftToasts is a lightweight, interactive toast notification library for SwiftUI that provides an elegant way to display temporary messages in iOS applications.
Key Components
Toast Struct
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
Creation Methods
- Simple Toast
Toast.simple("Notification Text", systemImage: "checkmark.circle")- Custom Toast
Toast { id in
// Custom toast content
}Usage Example
Check Demo.swift
Features
- Swipe-to-dismiss gesture
- Expandable toast view
- Stacked notification layout
- Smooth animations
- iOS 17+ visual effects support
Interaction Modes
- Compact mode: Stacked, overlapping toasts
- Expanded mode: Full list of toasts
Gesture Interactions
- Horizontal swipe left to dismiss
- Tap to expand/collapse toast stack
Compatibility
- Supports iOS 16+
- Optimized for iOS 17 with additional visual effects
Installation
Add the Swift file to your project or integrate via Swift Package Manager.
Package Metadata
Repository: c2p-cmd/SwiftToasts
Stars: 0
Forks: 0
Open issues: 0
Default branch: main
Primary language: swift
License: MIT
README: README.md