Toast-Swift alternatives and similar libraries
Based on the "Alert" category.
Alternatively, view toast-swift alternatives based on common mentions on social networks and blogs.
-
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
PMAlertController
PMAlertController is a great and customizable alert that can substitute UIAlertController -
Jelly
๐ - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API. -
MijickPopupView
Popups, popovers, sheets, alerts, toasts, banners, (...) presentation made simple. Written with and for SwiftUI. -
CDAlertView
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift -
SPAlert
DISCONTINUED. Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. [Moved to: https://github.com/varabeis/SPAlert] -
StatusAlert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way. -
SPIndicator
Floating indicator, mimicrate to indicator which appear when silent mode switched. Can be present from top and bottom. Interactive with gesters. -
Indicate
Interactive notification pop-over (aka "Toast) modeled after the iOS AirPods and Apple Pencil indicator.
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Toast-Swift or a related project?
README
Toast-Swift
A Swift Toast view - iOS 14 style - built with UIKit. ๐
Installation
Swift Package Manager
You can use The Swift Package Manager to install Toast-Swift by adding the description to your Package.swift file:
dependencies: [
.package(url: "https://github.com/BastiaanJansen/toast-swift", from: "1.1.2")
]
CocoaPods
pod "ToastViewSwift"
Usage
To create a simple text based toast:
let toast = Toast.text("Safari pasted from Notes")
toast.show()
Or add a subtitle:
let toast = Toast.text("Safari pasted from Notes", subtitle: "A few seconds ago")
toast.show()
If you want to add an icon, use the default
method to construct a toast:
let toast = Toast.default(
image: UIImage(systemname: "airpodspro")!,
title: "Airpods Pro",
subtitle: "Connected"
)
toast.show()
Want to use a different layout, but still use the Apple style? Create your own view and inject it into the AppleToastView
class when creating a custom toast:
let customView: UIView = // Custom view
let appleToastView = AppleToastView(child: customView)
let toast = Toast.custom(view: appleToastView)
toast.show()
The show
method accepts several optional parameters. haptic
of type UINotificationFeedbackGenerator.FeedbackType
to use haptics and after
of type TimeInterval
to show the toast after a certain amount of time:
toast.show(haptic: .success, after: 1)
Configuration options
The text
, default
and custom
methods support custom configuration options. The following options are available:
Name | Description | Type | Default |
---|---|---|---|
autoHide |
When set to true, the toast will automatically close itself after display time has elapsed. | Bool |
true |
enablePanToClose |
When set to true, the toast will be able to close by swiping up. | Bool |
true |
displayTime |
The duration the toast will be displayed before it will close when autoHide set to true in seconds. | TimeInterval |
4 |
animationTime |
Duration of the show and close animation in seconds. | TimeInterval |
0.2 |
attachTo |
The view which the toast view will be attached to. | UIView |
nil |
let config = ToastConfiguration(
autoHide: true,
enablePanToClose: true,
displayTime: 5,
animationTime: 0.2
)
let toast = toast.text("Safari pasted from Notes", config: config)
Custom toast view
Don't like the default Apple'ish style? No problem, it is also possible to use a custom toast view with the custom
method. Firstly, create a class that confirms to the ToastView
protocol:
class CustomToastView : UIView, ToastView {
private let text: String
public init(text: String) {
self.text = text
}
func createView(for toast: Toast) {
// View is added to superview, create and style layout and add constraints
}
}
Use your custom view with the custom
construct method on Toast
:
let customToastView: ToastView = CustomToastView(text: "Safari pasted from Notes")
let toast = Toast.custom(view: customToastView)
toast.show()
Delegates
Below delegate functions are optional to implement when implementing ToastDelegate
.
extension MyViewController: ToastDelegate {
func willShowToast(_ toast: Toast) {
print("Toast will be shown after this")
}
func didShowToast(_ toast: Toast) {
print("Toast was shown")
}
func willCloseToast(_ toast: Toast) {
print("Toast will be closed after this")
}
func didCloseToast(_ toast: Toast) {
print("Toast was closed (either automatically, dismissed by user or programmatically)")
}
}
Licence
Toast-Swift is available under the MIT licence. See the LICENCE for more info.
*Note that all licence references and agreements mentioned in the Toast-Swift README section above
are relevant to that project's source code only.