Skip to content

Lightweight Swift Package for Android-style toast notifications on iOS (UIKit & SwiftUI compatible)

License

Notifications You must be signed in to change notification settings

3sidedcube/cubetoast-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight Swift Package for toasts. Spiritual successor to MessageStackView.

SwiftUI

struct ContentView: View {
    @State private var toast: Toast?

    var body: some View {
        Button("Show toast") {
            toast = Toast(image: .sfSymbol("checkmark"), text: "Saved!")
        }
        .toast($toast)
    }
}

UIKit

let toastContainer = ToastContainerView()
view.addSubview(toastContainer)
NSLayoutConstraint.activate([
    toastContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor),
    toastContainer.trailingAnchor.constraint(equalTo: view.trailingAnchor),
    toastContainer.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)
])

toastContainer.show(Toast(image: .sfSymbol("checkmark"), text: "Saved!"))

About

Lightweight Swift Package for Android-style toast notifications on iOS (UIKit & SwiftUI compatible)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages