https://github.com/ukushu/toastack
Toast Stack – the simplest way to show and manage toasts in SwiftUI.
https://github.com/ukushu/toastack
alert-toast alert-toast-swiftui custom-toast swiftui toast toast-alert toast-message toast-notification toast-notifications toastnotifications
Last synced: about 2 months ago
JSON representation
Toast Stack – the simplest way to show and manage toasts in SwiftUI.
- Host: GitHub
- URL: https://github.com/ukushu/toastack
- Owner: ukushu
- License: mit
- Created: 2025-04-20T16:47:55.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-05-03T11:32:35.000Z (5 months ago)
- Last Synced: 2025-07-12T00:29:13.289Z (3 months ago)
- Topics: alert-toast, alert-toast-swiftui, custom-toast, swiftui, toast, toast-alert, toast-message, toast-notification, toast-notifications, toastnotifications
- Language: Swift
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
# TOASTack = Toast Stack
[](https://swiftpackageindex.com/ukushu/TOASTack)
[](https://swiftpackageindex.com/ukushu/TOASTack)```
git@github.com:ukushu/TOASTack.git
https://github.com/ukushu/TOASTack.git
```Works on:
* iOS >= .v16
* macOS >= .v13# How to use:
1) apply on your MainView:
```swift
MainView()
.applyToaster()
```2) Make your own design of ToastView or use `ToastSample1`, `ToastSample2`
3) Add toast to the stack of toasts:
```swift
Button(action: {
Toaster.shared.make { id in
ToastSample1(id: id)
}
}) {
Text(verbatim: "Make toast for me!")
}
```And that’s it.
Seriously — nothing else needed.
This is result:


## But also there is also exist configs :)
```swift
Toaster.shared.config.animation = .easeInOut
Toaster.shared.config.dimOnToast = true
Toaster.shared.config.edge = .bottom
//... and other
```## How to create more awesome custom designs?
Check out [ToastSample2.swift](https://github.com/ukushu/TOASTack/blob/main/Sources/TOAStack/Toast_Designs/Samples/ToastSample2.swift). It demonstrates how to:
* Populate your toast with dynamic data
* Create a custom design
* Add an animated icon
* Dismiss the toast with a horizontal swipe in either directionNow, let’s implement a “random toast generator” using the `ToastSample2` view:
```swift
func makeSomeToast() {
let title = ["Hello", "Title", "You miss the call", "Banana", "I'm waiting for you", "Why so sad?"]
.randomElement()!
let sf = ["bell", "bell.and.waves.left.and.right.fill","music.note","exclamationmark.3","exclamationmark.shield"]
.randomElement()!
let color = [Color.black, Color.blue, Color.red, Color.brown].randomElement()!
let toastData = SampleToastData(title: title, descr: "Some descr text blablabla bla", sfSymbol: sf, color: color)
Toaster.shared
.make { id in
// custom design of the toast
ToastSample2(id: id)
// Put data to display into the toast
.environmentObject(toastData)
}
}
```
result:
# Current Toast design templates:
## CapsuleToast:
* iOS/macOS polished
* Title
* Optional description (displayed in one line only)
* Optional SF Symbol (displayed on the left corner)
* Close button (displayed on the right corner)## CRToast:

* Multiline title
* Optional SF Symbol (displayed on the left corner)
* Close button (displayed on the right corner)
* Toast color# How you can help this project?
1) Create your own custom toast design
2) Polish it for both iOS and macOS
3) Place your design in the "Toast_Designs" directory as a separate file
4) Submit a Pull Request — share your toast template with the community! :)OR
You can improve existed designs :) Feel free to do this as you want :)
PS: If you need support of watchOS/ VisionOS - feel free to make Pull Request with edit of "Package.swift" after testing on real device.