Skip to content

A swift package to implement iOS14 style toast in your apps.

Notifications You must be signed in to change notification settings

twentyone24/floaters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

floaters

Toasts and popups library written with SwiftUI


Twitter

Usage

  1. Put all your body code into a ZStack
  2. Add a binding bool to control popup presentation state
  3. Add .popup modifier to your ZStack
@State var showingPopup = false

struct ContentView: View {
    var body: some View {
        ZStack {
            // your view
        }
        .popup(isPresented: $showingPopup, animation: Animation.spring(), autohideIn: 2) {
            Toast(image: "airpodspro", title: "AirPods Pro", subtitle: "Connected")
        }
    }
}

Required parameters

presented - binding to determine if the popup should be seen on screen or hidden
view - view you want to display on your popup

Available customizations - optional parameters

animation - custom animation for popup sliding onto screen
autohideIn - time after which popup should disappear

Installation

dependencies: [
    .package(url: "https://github.com/twentyone24/floaters.git", from: "0.0.1")
]

About

A swift package to implement iOS14 style toast in your apps.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages