Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philippeweidmann/toastview
Present a small toast as seen in the Apple Music App
https://github.com/philippeweidmann/toastview
Last synced: about 1 month ago
JSON representation
Present a small toast as seen in the Apple Music App
- Host: GitHub
- URL: https://github.com/philippeweidmann/toastview
- Owner: PhilippeWeidmann
- License: mit
- Created: 2023-10-22T10:24:42.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-24T07:59:45.000Z (about 1 year ago)
- Last Synced: 2024-01-26T03:10:14.089Z (11 months ago)
- Language: Swift
- Size: 50.8 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ToastView
Present a small toast as seen in the Apple Music App
![Toast](./Screenshots/toast.png)# Usage
## SwiftUI
Simply add the `toast` ViewModifier.
The view is presented as soon as `isPresented = true`.
You can provide an optional title and/or image.After dismiss the State is automatically reseted to `false`
```swift
import ToastView@State var isShowing = false
var body: some View {
VStack {
Button("Show Toast") {
isShowing.toggle()
}
}
.toast(isPresented: $isShowing,
title: "Toast",
icon: Image(systemName: "checkmark.circle"))
}
```## UIKit
Call `ToastPresenter.show`. You need to provide an origin view so that the toast knows in which WindowScene it is presented.
You can provide an optional title and/or image.```swift
import ToastViewToastPresenter.show(title: "Toast",
icon: UIImage(systemName: "checkmark.circle"),
origin: viewController.view)
```