Skip to content

iUsmanN/toastkit-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToastKit

A simple lightweight framework to present toasts in SwiftUI and UIKit.

  • Toasts are overlayed on top of the existing view - they are not user interactable.
  • Each toast automatically dismisses after 2 seconds.
  • A new toast is not presented while the previous one is visible.

As per the latest update,

  • Liquid toasts are only supported with Dynamic Island devices on Portrait orientation.
  • Drop toasts are supported with both Notch and Dynamic Island devices.
  • Only Glass and Solid toasts are supported with landscape orientation.

Toast Types

There are 4 types of Toasts that can be presented: Liquid, Drop, Glass and Solid


Example SwiftUI Code:

import SwiftUI
import ToastKit

struct ExampleView: View {
    var body: some View {
        Button(action: {
            ToastKit.present(message: "Some cool message", color: Color.yellow) // Step 2
        }, label: {
            Text("Present Toast")
        })
        .onAppear {
            ToastKit.configure(type: .glass) // Step 1
        }
    }
}

#Preview {
    ExampleView()
}

Usman Nazir

About

Simple Lightweight Toasts on iOS with SwiftUI and UIKit

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages