Easily display toast messages with optional icons, progress indicators, and stunning Liquid Glass effects in your iOS and tvOS apps.
- π Display simple toast messages or toasts with icons.
- π Optional progress indicator for toasts that represent a loading state.
- β¨ Liquid Glass effect on iOS 26+ / tvOS 26+ with automatic fallback to blur on older versions.
- π Automatic dark mode and light mode support.
- π Optional blurred/glass background to overlay entire application.
- π± Full support for iOS 13+ and tvOS 13+.
- π 7 customizable toast display positions (topLeft, top, topRight, center, bottomLeft, bottom, bottomRight).
- π€ Multi-line message support.
- π― Multiple toasts support with smart positioning.
- π Smart TabBar detection: Automatically positions bottom toasts above the UITabBarController when present (16px spacing).
- iOS 13.0+ / tvOS 13.0+
- Xcode 15.0+
- Swift 5.9+
Add ToastView to your project via Swift Package Manager:
dependencies: [
.package(url: "https://github.com/paoloandrea/ToastView.git", from: "2.0.0")
]- Download the
ToastManager.swiftandToastView.swiftfiles from this repository. - Add them to your Xcode project.
- Basic Toast
Since
ToastManageris a singleton, you do not instantiate it directly. Instead, you access the shared instance as follows:
let toastManager = ToastManager.sharedtoastManager.showToast(
message: "Your message here",
image: UIImage(named: "your_image_name"),
isProgress: false,
position: .center,
duration: 2.0,
in: yourView,
withBackground: true)- Toast with Icon
let image = UIImage(systemName: "star.fill")
toastManager.showToast(message: "Starred", image: image, position: .top)- Toast with Progress Indicator
toastManager.showToast(message: "Loading...", isProgress: true, position: .bottom)- Toast with Blurred Background Overlay
toastManager.showToast(message: "Blurred Background", position: .center, withBackground: true)- Dismiss Toast Manually
toastManager.cancelCurrentToast()- Dismiss Toast After a Delay
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
toastManager.cancelCurrentToast()
}Update the message of the current toast without creating a new one:
toastManager.message = "Updated message"Enable multiple toasts to stack vertically:
toastManager.allowMultipleToasts = true
toastManager.showToast(message: "First toast", position: .top)
toastManager.showToast(message: "Second toast", position: .top)Available positions:
- Standard positions:
.topLeft,.top,.topRight,.center,.bottomLeft,.bottom,.bottomRight - Forced above TabBar:
.bottomLeftAboveTabBar,.bottomAboveTabBar,.bottomRightAboveTabBar
ToastView offers two modes for handling tab bars:
When displaying toasts at bottom positions (.bottom, .bottomLeft, .bottomRight), ToastView automatically detects if a UITabBarController is present in the view hierarchy. If a visible tab bar is found, the toast will be positioned 16px above the tab bar.
// Automatic detection - positions above tab bar if present
toastManager.showToast(message: "Auto-positioned toast", position: .bottom)For explicit control, use the dedicated "AboveTabBar" positions (.bottomAboveTabBar, .bottomLeftAboveTabBar, .bottomRightAboveTabBar). These positions always place the toast above the standard tab bar height, even if no tab bar is detected.
// Always positions above tab bar area (even without UITabBarController)
toastManager.showToast(message: "Forced above tab bar", position: .bottomAboveTabBar)Note: Automatic detection works when:
- A
UITabBarControllerexists in the view hierarchy - The tab bar is visible (not hidden)
The manual positions use a fallback height (49px + 16px spacing) when no tab bar is detected.
On iOS 26 and tvOS 26 or later, ToastView automatically uses the stunning Liquid Glass effect (UIGlassEffect) for a modern, translucent appearance. On older versions, it gracefully falls back to UIBlurEffect.
ToastView automatically adapts to the system's light/dark mode appearance using semantic colors and adaptive materials.
- allowMultipleToasts: Set to
trueto allow showing multiple toasts at once (default:false). - message: Update the current toast message without recreating the toast.
- duration: Set to
0for indefinite display, or specify seconds for auto-dismiss. - withBackground: Add a blurred/glass overlay behind the toast.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT License - see LICENSE for details.
