ersanq/toastkit
Beautiful toast notifications for iOS. One line. Four styles. Zero setup.
Features
- ✅
Toast.show("message", style: .success)— one line anywhere in your app - ✅ 4 built-in styles — success, error, warning, info
- ✅ Custom colors, duration, and position (top / bottom)
- ✅ Queued — multiple toasts won't overlap
- ✅ Animated spring entrance + smooth exit
- ✅ Tap to dismiss
- ✅ SF Symbols icons
- ✅ Zero dependencies — pure UIKit
- ✅ iOS 16+, visionOS 1+
Installation
https://github.com/ErsanQ/ToastKit.package(url: "https://github.com/ErsanQ/ToastKit", from: "1.0.0")Usage
One-liners
Toast.success("Profile updated")
Toast.error("Upload failed")
Toast.warning("Low storage space")
Toast.info("Sync complete")With duration
Toast.show("Order placed! 🎉", style: .success, duration: 4)Bottom position
Toast.show(
"Message sent",
style: .success,
configuration: ToastConfiguration(position: .bottom)
)Custom colors
Toast.show(
"Premium unlocked ✨",
style: .custom(background: .purple, foreground: .white)
)Full configuration
let config = ToastConfiguration(
duration: 3.5,
position: .bottom,
showIcon: true,
cornerRadius: 20,
tapToDismiss: true
)
Toast.show("Done!", style: .success, configuration: config)Dismiss programmatically
Toast.dismiss()API Reference
Toast
| Method | Description | |--------|-------------| | show(:style:configuration:) | Full control | | show(:style:duration:) | Quick duration override | | success(:duration:) | Green toast | | error(:duration:) | Red toast | | warning(:duration:) | Orange toast | | info(:duration:) | Blue toast | | dismiss() | Dismiss current toast |
ToastStyle
.success .error .warning .info .custom(background:foreground:)
ToastConfiguration
| Property | Default | Description | |----------|---------|-------------| | duration | 2.5 | Seconds before auto-dismiss | | position | .top | .top or .bottom | | showIcon | true | SF Symbol icon | | cornerRadius | 14 | Corner radius | | tapToDismiss | true | Tap to dismiss |
Requirements
- iOS 16.0+ / visionOS 1.0+
- Swift 5.9+
- Xcode 15.0+
License
MIT License. See LICENSE.
Package Metadata
Repository: ersanq/toastkit
Default branch: main
README: README.md