Swiftpack.co -  jknlsn/SwiftUIToast as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
jknlsn/SwiftUIToast
A simple Toast view in SwiftUI, like the AirPods toast
.package(url: "https://github.com/jknlsn/SwiftUIToast.git", from: "v0.0.1")

SwiftUIToast

A simple Toast view in SwiftUI.

Key features:

  • single wrapper over primary view
  • global state, call from anywhere as function rather than wrapper and binding

Usage

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)
    }

}

GitHub

link
Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

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