A simple Toast view in SwiftUI.
Key features:
import SwiftUIToast
// Wrap your content in a ToastContainerView so that the toast can always appear on top.
// A good spot to put this is in your ContentView file.
SwiftUIToast.ToastContainerView {
// Your content goes here
ZStack{
Color.green
Button(action: {
// Show a toast by calling the show function anywhere
SwiftUIToast.show(
image: "airpodsmax",
text: "Playing music"
)
}) {
Text("Toggle")
}
}
.onAppear{
// You can set the defaults any time to affect every Toast
Toast.setDefaults(duration: 2.0, shadow: 0.0, position: .bottom)
}
}
link |
Stars: 2 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics