Contents

philippeweidmann/notificationtoast

A view that tries to replicate iOS default toast message view.

UIKit

import NotificationToast

let toast = ToastView(title: "Safari pasted from Notes")
toast.show()

The view also includes many optional customizable properties:

let toast = ToastView(
    title: "Airpods Pro",
    titleFont: .systemFont(ofSize: 13, weight: .regular),
    subtitle: "Connected",
    subtitleFont: .systemFont(ofSize: 11, weight: .light),
    icon: UIImage(systemName: "airpodspro"),
    iconSpacing: 16,
    position: .bottom,
    onTap: { print("Tapped!") }
)
toast.show()

You can present the view with a haptic feedback at the same time (nil by default) :

toast.show(haptic: .success)

SwiftUI

    @State var isPresented = false

    Button("Present toast") {
        isPresented = true
    }
    .toast(isPresented: $isPresented, title: "Safari pasted from Notes")

Similarly to UIKit, you can customize the view using the optional parameters (see auto-completion for all the options):

    @State var isPresented = false

    Button("Present toast") {
        isPresented = true
    }
    .toast(isPresented: $isPresented, title: "AirPods Pro", subtitle: "Connected", icon: UIImage(systemName: "airpodspro"))

Contribute

As this is my first 'UI' package I'm sure it can be greatly improved, PR are welcome 😊

Alternatives

Drops 💧: https://github.com/omaralbeik/Drops Bauly : https://github.com/wiencheck/Bauly

Package Metadata

Repository: philippeweidmann/notificationtoast

Default branch: master

README: README.md