Swiftpack.co - jebenjamin/SwiftUIToast as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jebenjamin.
jebenjamin/SwiftUIToast 1.0.5
A Swift package for displaying sleek iOS-style toast notifications.
⭐️ 1
🕓 1 year ago
iOS macCatalyst
.package(url: "https://github.com/jebenjamin/SwiftUIToast.git", from: "1.0.5")


A package for displaying sleek iOS-style toast notifications with SwiftUI. It's intended to mimic the toasts seen when charging an Apple Pencil or connecting AirPods.



Swift Package Manager

SwiftUIToast is a Swift package that can be installed through the 'Package Dependencies' list in your Xcode project. Or, you can add the following line to your own Package.swift file:

dependencies: [
    .package(url: "https://github.com/jebenjamin/SwiftUIToast", from: "1.0.3")


Add the following line to your PodFile:

pod 'SwiftUIToast'


Drag and drop the SwiftUIToast folder into your project.


First, you'll need to create a ToastOptions object that holds all the parameters of your Toast. Like so:

let options = ToastOptions(
    title: "Title",
    subtitle: "Subtitle",
    position: .top,
    duration: 5,
    dismissible: true

Next, you can use a ZStack to layer a ToastView on top of the view you want to display a toast for.

ZStack {
    ToastView(options: options)
    // and some other views...

Once the toast fades out, the view is removed from the hierarchy. The view automatically adapts to the current color scheme (light or dark mode).


  • image: A SwiftUI Image displayed on the left-hand side of the toast. Optional.
  • title: A title string that will be displayed at the top of the toast. Required.
  • subtitle: A subtitle string that will be displayed at the bottom of the toast. Optional.
  • position: .top places the toast at the top of the stack, .bottom places it at the bottom. Required.
  • duration: The time in seconds to display the ToastView before fading away. Optional. If nil, the ToastView will appear indefinitely.
  • dismissible: If true, the toast will fade away when tapped.


Requires iOS 13.0+ or Mac Catalyst 13.0+.


SwiftUIToast uses the MIT license. A copy is available in LICENSE.


Stars: 1
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Related Packages

Release Notes

v1.0.5 - Improved accessibility
1 year ago

This update improves the usage of SwiftUIToast with accessibility features. The title and subtitle are combined into a single accessibility label.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics