A simple way to show toast in SwiftUI.

Overview

ToastUI logo

A simple way to show toast in SwiftUI

DocumentationExampleChange Log

Swift Package Manager CocoaPods Platform License

demo

Overview

ToastUI provides you a simple way to present toast, head-up display (HUD), custom alert, or any SwiftUI views on top of everything in SwiftUI.

Getting started

Here is an example to present an indefinite progress indicator HUD and dismiss it after 2 seconds.

struct ContentView: View {
  @State private var presentingToast: Bool = false

  var body: some View {
    Button {
      presentingToast = true
    } label: {
      Text("Tap me")
        .bold()
        .foregroundColor(.white)
        .padding()
        .background(Color.accentColor)
        .cornerRadius(8.0)
    }
    .toast(isPresented: $presentingToast, dismissAfter: 2.0) {
      print("Toast dismissed")
    } content: {
      ToastView("Loading...")
        .toastViewStyle(IndefiniteProgressToastViewStyle())
    }
  }
}

You can also present custom alerts or any SwiftUI views of your choice.

struct ContentView: View {
  @State private var presentingToast: Bool = false

  var body: some View {
    Button {
      presentingToast = true
    } label: {
      Text("Tap me")
        .bold()
        .foregroundColor(.white)
        .padding()
        .background(Color.accentColor)
        .cornerRadius(8.0)
    }
    .toast(isPresented: $presentingToast) {
      ToastView {
        VStack {
          Text("Hello from ToastUI")
            .padding(.bottom)
            .multilineTextAlignment(.center)

          Button {
            presentingToast = false
          } label: {
            Text("OK")
              .bold()
              .foregroundColor(.white)
              .padding(.horizontal)
              .padding(.vertical, 12.0)
              .background(Color.accentColor)
              .cornerRadius(8.0)
          }
        }
      }
    }
  }
}

Have a look at the ToastUISample project for more examples and also check out the Documentation below.

Requirements

  • iOS 14.0+ | tvOS 14.0+ | macOS 11.0+
  • Xcode 12.0+ | Swift 5.3+

Installation

Swift Package Manager

ToastUI is available through Swift Package Manager.

For app integration, add ToastUI to an existing Xcode project as a package dependency:

  1. From the File menu, select Swift Packages > Add Package Dependency...
  2. Enter https://github.com/quanshousio/ToastUI into the package repository URL text field.
  3. Xcode should choose updates package up to the next version option by default.

For package integration, add the following line to the dependencies parameter in your Package.swift .

dependencies: [
  .package(url: "https://github.com/quanshousio/ToastUI.git", from: "2.0.0")
]

CocoaPods

ToastUI is available through CocoaPods. To install it, add the following line to your Podfile :

pod 'ToastUI'

Documentation

For more detailed documentation, please see here.

Presenting

ToastUI supports presenting any SwiftUI views from anywhere. You just need to add toast() view modifier and provide your views, much like using alert() or sheet() .

.toast(isPresented: $presentingToast) {
  // your SwiftUI views here
}

There are two types of toast() view modifier. For more usage information, check out the examples.

  • toast(isPresented:dismissAfter:onDismiss:content:) – presents a toast when the given boolean binding is true.
  • toast(item:dismissAfter:onDismiss:content:) – presents a toast using the given item as a data source for the toast's content.

ToastView

ToastUI comes with ToastView , which visually represented as a rounded rectangle shape that contains your provided views and has a default thin blurred background.

.toast(isPresented: $presentingToast) {
  ToastView("Hello from ToastUI")
}

Layout of ToastView is demonstrated in this figure below.

+-----------------------------+
|                             |
|  <Background>               |
|                             |
|        +-----------+        |
|        |           |        |
|        | <Content> |        |
|        |           |        |
|        |           |        |
|        |  <Label>  |        |
|        +-----------+        |
|                             |
|                             |
|                             |
+-----------------------------+

ToastView(<Label>) {
  <Content>
} background: {
  <Background>
}

ToastView with custom content views and custom background views.

.toast(isPresented: $presentingToast) {
  ToastView("Saved!") {
    // custom content views
    Image(systemName: "arrow.down.doc.fill")
      .font(.system(size: 48))
      .foregroundColor(.green)
      .padding()
  } background: {
    // custom background views
    Color.green.opacity(0.1)
  }
}

ToastView using built-in styles and without background.

.toast(isPresented: $presentingToast) {
  ToastView("Loading...") {
    // EmptyView()
  } background: {
    // EmptyView()
  }
  .toastViewStyle(IndefiniteProgressToastViewStyle())
}

Styling

ToastUI supports seven different ToastViewStyle s out-of-the-box. You have to use ToastView and set the style accordingly by using toastViewStyle(_:) modifier. All styles have native support for dynamic type for accessbility.

  • DefaultProgressToastViewStyle() – shows an empty toast if user does not provide anything. ToastView uses this style by default.
  • IndefiniteProgressToastViewStyle() – shows an indefinite circular progress indicator.
  • DefiniteProgressToastViewStyle(value:total:) – shows a definite circular progress indicator from 0 to 100%.
  • SuccessToastViewStyle() – shows a success toast.
  • ErrorToastViewStyle() – shows an error toast.
  • WarningToastViewStyle() - shows a warning toast.
  • InfoToastViewStyle() – shows an information toast.

ToastUI includes a UI/NSVisualEffectView wrapper through cocoaBlur() view modifier, which is more flexible than existing blur(radius:opaque:) in SwiftUI.

  • cocoaBlur(blurStyle:vibrancyStyle:blurIntensity:) - for iOS.
  • cocoaBlur(blurStyle:blurIntensity:) - for tvOS.
  • cocoaBlur(material:blendingMode:state:) - for macOS.

Contributing

All issue reports, feature requests, pull requests and GitHub stars are welcomed and much appreciated.

Author

Quan Tran (@quanshousio)

Acknowledgements

  • Fruta - UI/NSVisualEffectView wrapper for SwiftUI by Apple.
  • Label - an informative article about SwiftUI Label and style erasers by Five Stars.
  • SVProgressHUD - original design of the circular progress HUD by Sam Vermette and Tobias Tiemerding.
  • SwiftUI Custom Styling - an informative article about SwiftUI custom styling by The SwiftUI Lab.

License

ToastUI is available under the MIT license. See the LICENSE file for more info.

Comments
  • dismissAfter not dismissing on iOS13

    dismissAfter not dismissing on iOS13

    Pre-requisites:

    • [x] Yes, I looked through both open and closed issues looking for what I needed
    • [x] No, I did not find what I was looking for

    I am trying to switch from my basic alerts to using ToastUI but I'm running into an issue. For some reason my toast won't dismiss even after the set dismissAfter time. Funny enough this is only an issue when running on a device with iOS <14. Seems like the dismissAfter functionality only works with the beta.

    Expected Behavior

    Should dismiss after the pre-defined time.

    Current Behavior

    Toast stays on the screen and dismiss is never called.

    Possible Solution

    Steps to Reproduce (for bugs)

        @State var showWarning = false // this is set to true when a warning is triggered
        var body: some View {
            VStack {
                 ...
            }.toast(isPresented: $showWarning, dismissAfter: 5.0, onDismiss: {
                print("Dismissing") // this never prints and the toast never goes away.
            }) {
                ToastView(self.messageContent).toastViewStyle(WarningToastViewStyle())
            }
        }
    

    Context

    Your Environment

    • Swift Version: 5.3 & 5.1
    • Xcode Version: 12.0 Beta 4 & 11.4
    • Operating System and Version: macOS Big Sur 11 and macOS Catalina 10.15
    • Device or Simulator: Device - iPhone 7 Plus iOS 13.6.1
    bug 
    opened by LucasCarioca 17
  • A ToastUI triggering while a SwiftUI Menu is active can sometimes later cause sheets to fail to open.

    A ToastUI triggering while a SwiftUI Menu is active can sometimes later cause sheets to fail to open.

    Pre-requisites:

    • [x] Yes, I looked through both open and closed issues looking for what I needed.
    • [x] No, I did not find what I was looking for.

    Expected Behavior

    Current Behavior

    Possible Solution

    A workaround is to use .contextMenu instead of Menu.

    Steps to Reproduce

    With this activated: Menu { Button() { UIPasteboard.general.string = selectedText } label: { Image(systemName: "doc.on.doc") Text("Copy") } } label: { Image(systemName: "ellipsis") .imageScale(.large) .padding() }

    And concurrently triggering a Toast: .toast(isPresented: $isLocked) { LockScreen() }

    And then later calling sheet(), for instance: .sheet(isPresented: $showQRCode) { QRCode(showQRCode: self.$showQRCode) } Will generate the following error:

    2021-07-09 23:21:11.290959+0200 AppName[10762:4800555] [Presentation] Attempt to present <TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView: 0x113507a20> on <TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_: 0x111d08800> (from <TtGC7SwiftUI19UIHostingControllerVS_14_ViewList_View: 0x111d2ca80>) which is already presenting <_UIContextMenuActionsOnlyViewController: 0x1137095f0>.

    Context

    I am using Toast to present a LockScreen that triggers when moving an app to the background. It works great with all other kinds of dialogs, like sheets or contextMenus, but using Menu causes the above issue.

    I am using XCode 12.5.1 iOS 14.6, iPhone 12 Pro Max

    bug help wanted 
    opened by JonnyReinEriksen 7
  • Attempt to present toast whose view is not in the window hierarchy

    Attempt to present toast whose view is not in the window hierarchy

    Pre-requisites:

    • [*] Yes, I looked through both open and closed issues looking for what I needed.
    • [*] No, I did not find what I was looking for.

    When attempting to trigger a toast to appear programmatically, I get the following error:

    [Presentation] Attempt to present <_TtGC7ToastUI26ToastViewHostingControllerGV7SwiftUI15ModifiedContentGVS_9ToastViewVS1_9EmptyViewVS1_4TextS4__GVS1_30_EnvironmentKeyWritingModifierVS_17AnyToastViewStyle___: 0x10193f040> on <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x104f11380> (from <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x104f11380>) whose view is not in the window hierarchy.
    

    The relevant section of my code looks like this:

    @State private var presentingToast = false
    @State private var uploadProgress = 0.0
    var body: some View {
        VStack {
            Button(action: {
                print("Show toast")
            }, label: {
                Text("")
            })
            .toast(isPresented: $presentingToast) {
                ToastView("Uploading...")
                    .toastViewStyle(DefiniteProgressToastViewStyle(value: $uploadProgress))
            }
            .hidden()
       
    

    When I set presentingToast to true, it gives me the aforementioned error. I've also tried removing the hidden modifier and putting in some words in the Text, but that doesn't make a difference.

    Your Environment

    • Swift Version: 5
    • Xcode Version: 12.3
    • Operating System Version: macOS Big Sur 11.1
    • Device or Simulator: iPhone 8 Plus
    bug help wanted 
    opened by OccultSlolem 7
  • ToastUI Warning attempt to dismiss from view controller (thousands) on 1.3.x

    ToastUI Warning attempt to dismiss from view controller (thousands) on 1.3.x

    Pre-requisites:

    • [X] Yes, I looked through both open and closed issues looking for what I needed.
    • [X] No, I did not find what I was looking for.

    Expected Behavior

    With ToastUI 1.3.2 whenever my toasts appear, I get thousands of errors that look like this:

    2021-02-25 13:48:22.726 iosApp[93595:9719510] Warning: Attempt to dismiss from view controller <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentGS1_GS1_GS1_GS1_V6iosApp8MainViewGVS_30_EnvironmentKeyWritingModifierGSqCS2_8AppState___GS4_GSqCS2_4User___GS4_GSqCS2_7Checkin___GS4_GSqCS2_4Team___GS4_GSqCS2_5Score____: 0x7faf04419390> while a presentation or dismiss is in progress!
    

    I don't know if this is something I'm doing wrong with how I'm using ToastUI or a bug in ToastUI 1.x, BUT if I upgrade to ToastUI 2.0.0, the issue goes away with my code remaining the same, so I suspect this is a bug in 1.x.

    However, I see that 2.0.0 no longer supports ios 13. We don't want to raise the minimum compat level for our app.

    Current Behavior

    Thousands of Warning messages when attempting to use ToastUI 1.3.0.

    Possible Solution

    We could have upgraded to 2.0.0 which fixes the issue, but can't right away since the minimum iOS version has been bumped.

    Your Environment

    • Swift Version: 5
    • Xcode Version: 12
    • Operating System Version: 11.2.1
    • Device or Simulator: iPhone 11 13.5
    bug help wanted 
    opened by rocketraman 6
  • Add basic GitHub templates

    Add basic GitHub templates

    Hey I was the guy that responded about possibly contributing back.

    I figured I would go ahead and start off by helping with some basic GitHub templates to make collecting issues, requests and PRs a little cleaner and more organized.

    I submitted my thoughts on a few templates tailored a bit for a swift project. Let me know your thoughts.

    You can see what these will look like in my fork https://github.com/LucasCarioca/ToastUI/issues/new/choose

    Screen Shot 2020-08-10 at 9 49 24 PM documentation enhancement 
    opened by LucasCarioca 5
  • Can I choose to not have background?

    Can I choose to not have background?

    Pre-requisites:

    • [ ] Yes, I looked through both open and closed issues looking for what I needed
    • [ ] No, I did not find what I was looking for

    Feature Suggestion

    Possible Implementation

    Context

    enhancement help wanted 
    opened by wyk111wyk 4
  • Can't present subsequent toast without using onDismiss on the first toast

    Can't present subsequent toast without using onDismiss on the first toast

    Pre-requisites:

    • [] Yes, I looked through both open and closed issues looking for what I needed
    • [x] No, I did not find what I was looking for

    I want to be able to display either a SuccessToastViewStyle or an ErrorToastViewStyle once my network request has finished.

    The ShowSuccessToastAfterCompletedExample in the example project works great, however my case is a little bit different. I make a network call which shows an indefinite alert. At the end of the request, it calls my completion handler and passes a Result. If there is a .success, I want to display a success alert, and if there is a .failure, I'll display an error alert.

    Example code:

    CustomButton("Tap me") {
        savingViewShowing = true
    
        model.makeNetworkRequest() { result in
            switch result {
                case .success:
                    savingViewShowing = false
                    showSuccessAlert = true
                case .failure:
                    savingViewShowing = false
                    showErrorAlert = true
            }
        }
    }
    .toast(isPresented: $savingViewShowing) {
        ToastView("Saving...")
            .toastViewStyle(IndefiniteProgressToastViewStyle())
    }
    .toast(isPresented: $showSuccessAlert, dismissAfter: 1.0, onDismiss: { resetForm() }) {
        ToastView("Success!")
            .toastViewStyle(SuccessToastViewStyle())
    }
    .toast(isPresented: $showErrorAlert, dismissAfter: 1.0) {
        ToastView("Error!")
            .toastViewStyle(ErrorToastViewStyle())
    }
    

    However, the above doesn't work. The "Saving" alert will show fine, but nothing will show after that.

    Changing my "Saving" alert's onDismiss to set showSuccessAlert to true does work:

    .toast(isPresented: $savingViewShowing, onDismiss: { showSuccessAlert = true }) {
        ToastView("Saving...")
            .toastViewStyle(IndefiniteProgressToastViewStyle())
    }
    

    This isn't great when I don't know at build time which alert to show in my completion handler. I could create a lot of extra @States that hold success/fail, but that isn't ideal.

    Is there something I'm doing wrong, or is there something that can be fixed?

    Your Environment

    • Swift Version: 5
    • Xcode Version: 12 beta 4
    • Operating System and Version: iOS 14 beta 4
    • Device or Simulator: Simulator and device
    bug help wanted 
    opened by roddymunro 3
  • IndefiniteProgressToastViewStyle has spinner constantly moving from top left to the toast

    IndefiniteProgressToastViewStyle has spinner constantly moving from top left to the toast

    Before I start, great repository here. It's been great to work with.

    I've encountered a weird issue when implementing toast using IndefiniteProgressToastViewStyle() with a network request. For the duration of the request, the spinner will repeatedly move from the top left of the screen into the center of the toast. Once the request is complete, the toast disappears as expected.

    Here's a gif of the issue: https://giphy.com/gifs/VgHGygxhGNeB3zIhS2

    This is happening on iPhone 11 Pro Max simulator, Xcode 12 beta 4, iOS 14 beta 4.

    Code example:

    var body: some View {
            TabView(selection: $selection) {
                NavigationView {
                    Text("my view")
                }
                .tabItem {
                    Label("Test", systemImage: "book")
                        .imageScale(.large)
                        .accessibility(label: Text("Test"))
                }
            }
            .toast(isPresented: $showLoadingView) {
              ToastView("Loading...")
                .toastViewStyle(IndefiniteProgressToastViewStyle())
            }
            .onAppear {
                showLoadingView = true
                model.loadAllData { result in
                    switch result {
                        case .success:
                            showLoadingView = false
                        case .failure(let error):
                            // show error stuff
                    }
                }
            }
        }
    
    bug 
    opened by roddymunro 3
  • Custom toast question

    Custom toast question

    Pre-requisites:

    • [ *] Yes, I looked through both open and closed issues looking for what I needed
    • [ *] No, I did not find what I was looking for

    Nice work guys - question how did you pull off the green bottom aligned toast in the animated gif example exactly? Would love to see an example.

    Screen Shot 2020-12-23 at 2 18 42 PM enhancement help wanted 
    opened by barrylachapelle 2
  • Failing to compile when added as a swift package

    Failing to compile when added as a swift package

    I wanted to try the package out a bit and I added it to a brand new project and it fails to compile.

    There is nothing else in the project and it is showing a failure when compiling ToastUI.

    Here is the error

    loading unsized types is not allowed
      load void, void* %53, align 8, !dbg !316
    Function return type does not match operand type of return inst!
      ret void <badref>, !dbg !316
     doublein function $s7ToastUI07DefaultA9ViewStyleV0caD0V11_cornerSize33_E64FDF835852504B4904DF0A39BD1713LLAA20ScaledMetricPropertyVy12CoreGraphics7CGFloatVGvpfi
    <unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
    <unknown>:0: note: Broken function found, compilation aborted!
    
    opened by LucasCarioca 2
  • Compiler Warning since ios15

    Compiler Warning since ios15

    Hi,

    I get a warning since i updated to iOS 15: .../ToastUI/ToastViewEnvironmentKey.swift:13:16: Expected member name or constructor call after type name

    I use ToastUI version 2.0.0

    Beste regards

    ios15toastui1

    bug help wanted 
    opened by scherhak 1
  • Add `isUserInteractionEnabled`

    Add `isUserInteractionEnabled`

    Pre-requisites:

    • [ ] No, I did not find what I was looking for

    Feature Suggestion

    After having implemented the toast library I have found myself with the need for the user to be able to click inside the view in which it is presented so that he can perform certain actions while the Toast view is present.

    Possible Implementation

    I add a link to my repository so you can make a merge to yours.(https://github.com/quanshousio/ToastUI/compare/main...olegtverdyy:ToastUI:feature/add-isUserInteractionEnabled)

    Context

    • I present a toast at the bottom of the screen.
    • The user tries to click on another option on the screen to perform a navigation.
    • As the toast is displayed, he is not allowed to do so.

    For it I have enabled the isUserInteractionEnabled option, to allow the user to make this action.

    enhancement help wanted 
    opened by olegtverdyy 0
  • After Toast dismiss and auto push to next View ,  NavigationBar height not correct

    After Toast dismiss and auto push to next View , NavigationBar height not correct

    Pre-requisites:

    • [ ] Yes, I looked through both open and closed issues looking for what I needed.
    • [ ] No, I did not find what I was looking for.

    Expected Behavior

    when toast dismiss and auto push to next view , NavigationBar height should be correct image

    Current Behavior

    when toast dismiss and auto push to next view , NavigationBar height isn't correct image

    Possible Solution

    maybe code implement leads the bug

    Steps to Reproduce

    • toast loading
    • dismiss toast and auto push to next view in swiftUI
    • NavigationBar height of next view height isn't correct

    Context

    Your Environment

    • Swift Version: 5.6
    • Xcode Version: 13.3
    • Operating System Version: macOS 12.4
    • Device or Simulator: iOS 15 iPad mini 6
    bug help wanted 
    opened by ACFancy 0
  • Showing ToastUI on app load

    Showing ToastUI on app load

    Pre-requisites:

    • [x] Yes, I looked through both open and closed issues looking for what I needed.
    • [x] No, I did not find what I was looking for.

    Expected Behavior

    Be able to show the ToastUI at app load. Useful when doing initial network requests like auth or other early tasks

    Current Behavior

    Currently the ToastUI does not appear

    Steps to Reproduce

    struct TestView: View {
        @State private var isLoading: Bool = false
    	
        var body: some View {
            VStack {
                Text(isLoading ? "Please wait..." : "Got auth token")
                    .padding()
                Spacer()
            }
            .toast(isPresented: $isLoading) {
                ToastView("Loading").toastViewStyle(.indeterminate)
            }
            .onAppear {
                self.isLoading = true
            }
        }
    }
    

    Context

    I basically want to open the app and the ToastUI to be visible until some network requests are done in the background Disclaimer: I'm still new to SwiftUI so i might try to achieve this the wrong way

    Your Environment

    • Swift Version: 5.5
    • Xcode Version: 13.4
    • Operating System Version: macOS Monteray 12.4
    • Device or Simulator: Irrelevant
    bug help wanted 
    opened by rursache 3
  • Hide toast when system alert occurs

    Hide toast when system alert occurs

    Pre-requisites:

    • [ ] No, I did not find what I was looking for

    Feature Suggestion

    If a toast is currently shown and a system alert appears (e.g. contacts permission request), add a possibility to hide the toast so they do not overlap.

    Context

    1. Start a new iOS Project with Lifecycle Storyboard
    2. In the ViewController.swift replace the code with the code below.
    3. Add NSContactsUsageDescription key in info.plist.
    4. Build the project
    5. Tap "show toast" button. After 5 seconds from start, a system alert will appear above the toast so that they are overlapping.

    Is there a way to automatically hide toast when a system alert appears ? This is obviously just a minimum working example, at the end this can be any system alert. Another thing is, sometimes alerts will come from external libs making it even harder to manage.

    import UIKit
    import SwiftUI
    import Contacts
    import ToastUI
    
    struct ContentView: View {
        @State var showToast = false
        
        var body: some View {
            VStack {
                Button {
                    showToast = true
                } label: {
                    Text("show toast")
                }
                .toast(isPresented: $showToast) {
                    ZStack {
                        Color.black
                            .frame(width: 300, height: 300)
                        ProgressView()
                            .tint(.white)
                            .scaleEffect(4)
                       
                    }
                }
            }
        }
    }
    
    class ViewController: UIViewController {
        var contactStore = CNContactStore()
        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view.
    //
            let hostingController = UIHostingController(rootView: ContentView())
            DispatchQueue.main.asyncAfter(deadline: .now() + 5) { [self] in
               
                requestForAccess { val in
                    print(val.description)
                }
            }
    
            self.navigationController?.pushViewController(hostingController, animated: false)
        }
                                       
        fileprivate func requestForAccess(completionHandler: @escaping (_ accessGranted: Bool) -> Void) {
                let authorizationStatus = CNContactStore.authorizationStatus(for: CNEntityType.contacts)
                
                switch authorizationStatus {
                case .authorized:
                    completionHandler(true)
                    
                case .notDetermined:
                    self.contactStore.requestAccess(for: CNEntityType.contacts, completionHandler: { (access, accessError) -> Void in
                        if access {
                            completionHandler(access)
                        }
                        else {
                            completionHandler(false)
                        }
                    })
                    
                default:
                    completionHandler(false)
                }
            }
    
    }
    
    enhancement help wanted 
    opened by nepysb 3
  • change Toast position

    change Toast position

    Pre-requisites:

    • [x] No, I did not find what I was looking for

    Feature Suggestion

    Is there any Idee how we change the position of Toast toast was always displayed in the middle and we do not want that best if you can change the position of the toast, would it be possible to do it?

    enhancement help wanted 
    opened by rami-almofleh 1
Releases(3.0.1)
  • 3.0.1(Jul 19, 2022)

  • 3.0.0(Apr 11, 2022)

    Released on 2022-04-11.

    Changed

    • Minimum required version for Swift is 5.5.
    • Visual changes:
      • ToastUI shows a dimmed background when presenting a toast instead of a blurred background. This replicates the behavior of a normal UIAlertController.
      • Multi-line text alignment for Label of DefaultToastViewStyle is center-aligned.
    • API changes:
      • IndefiniteProgressToastViewStyle is renamed to IndeterminateProgressToastViewStyle.
      • DefiniteProgressToastViewStyle is renamed to DeterminateProgressToastViewStyle.
      • ErrorToastViewStyle is renamed to FailureToastViewStyle.
      • InfoToastViewStyle is renamed to InformationToastViewStyle.
      • AnyToastViewStyle is marked as private.
      • ToastViewStyleConfiguration properties are refactored to use a generic type instead of AnyView.
      • VisualEffectView and cocoaBlur modifier are removed. Use blur or background with Material on iOS 15.0+ modifiers if possible.
    • Toast presentation and dismissal mechanisms are redesigned:
      • On iOS and tvOS, toast is presented in a separate window instead of the view controller where it is called.
      • On macOS, toast is presented in the same window where it is called instead of a separate sheet.
      • On watchOS, toast is presented using the built-in sheet modifier due to the limitation of WatchKit APIs.
      • The new mechanism should be more robust against failures and warns the user appropriately if a failure occurs.
    • DocC replaces Jazzy as the new tool for generating documentation.
    • Support for CocoaPods dependency manager is removed. Use Swift Package Manager instead.
    • Default git branch is renamed to main.

    Added

    • Support for watchOS. Minimum required version for watchOS is 7.0
    • Static property/function for all built-in styles to leverage the new static member lookup functionality.
    • toastDimmedBackground modifier for enabling or disabling the dimmed background.
    • IconToastViewStyle style for showing a toast with an icon and a headline text label.

    Updated

    • ToastUISample is reorganized and include new examples.
    • GitHub actions are streamlined and updated (#25).

    Fixed

    • ToastUI fails to present the toast when there is a presented view controller (#21 and #24).
    • Compiler warning for missing the metatype in EnvironmentValues.toastViewStyle (#26).
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Jan 20, 2021)

    Released on 2021-01-20.

    Added

    • Support for macOS 11.0.

    Updated

    • Use SwiftUI application life cycle.
    • Reorganize the ToastUISample project.
    • Use built-in onChange modifier and @ScaledMetric property.

    Removed

    • Support for iOS 13.0 and tvOS 13.0.
    • Custom OnChangeModifier and ScaledMetricProperty.
    Source code(tar.gz)
    Source code(zip)
  • 1.3.2(Jan 13, 2021)

  • 1.3.1(Nov 15, 2020)

  • 1.3.0(Nov 14, 2020)

    Released on 2020-11-14.

    Added

    • dismissAfter handle for ToastViewItemModifier.

    Updated

    • New example of ToastViewStyle and minor refactoring on ToastUISample.
    • Multi-line text alignment for label of built-in ToastViewStyle is center by default.
    • GitHub actions for pushing to CocoaPods trunk and minor changes to GitHub actions.

    Removed

    • ToastView initializer with ToastViewStyleConfiguration.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Oct 9, 2020)

  • 1.2.0(Oct 9, 2020)

    Released on 2020-10-09.

    Added

    • New logo for ToastUI .
    • Support for custom background in ToastView .

    Updated

    • ToastViewPreferenceKey has been removed. Presenting toast is now handled by using onChange modifier.
    • cocoaBlur modifier adds VisualEffectView as a background instead of using ZStack .
    • Default UIBlurEffectStyle for blurred background of ToastView is .prominent for both iOS and tvOS.
    • Utilize Swift 5.3 functionalities.
    • Documentation for ToastView and README.

    Fixed

    • Incorrect keyWindow is used in callbacks when there are multiple foreground active scenes.
    • ToastViewPreferenceKey tried to update multiple times per frame is thrown in some cases.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Oct 6, 2020)

  • 1.1.0(Oct 5, 2020)

    Released on 2020-10-05.

    Added

    • SwiftLint to enforce Swift conventions.

    Updated

    • Minimum required version for Swift is 5.3.
    • Minor code formatting and filename changes.
    • Remove redundant unit tests.

    Fixed

    • Memory leak due to improper asynchronous usage of UIViewPropertyAnimator in VisualEffectView .
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Aug 16, 2020)

    Released on 2020-08-16.

    Added

    • GitHub actions for building package and documentation.

    Updated

    • Rename VisualEffectBlur to VisualEffectView .
    • Documentation and README.

    Fixed

    • Typos and formatting in ToastUISample.
    • Exception when property animator is not properly released.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Aug 16, 2020)

  • 1.0.0(Aug 4, 2020)

Owner
Quan Tran
0xffff0
Quan Tran
Show MS Windows style activation dialog on my screen.

Activate Mac The "Activate Windows" watermark ported to macOS with Swift Objective-C. Special thanks: MrGlockenspiel/activate-linux for the idea. Inst

Lakr Aream 195 Dec 23, 2022
Simple way to present custom views as a popup in iOS and tvOS.

PopupKit PopupKit is a simple and flexible iOS framework for presenting any custom view as a popup. It includes a variety of options for controlling h

Pointwelve 59 Mar 1, 2022
Simple Swift class for iOS that shows nice popup windows with animation.

NMPopUpView Simple class for iOS that shows nice popup windows, written in Swift. The project is build with Swift 4.0, so you need Xcode 9.0 or higher

Nikos Maounis 194 Jun 5, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.8k Dec 20, 2022
Simple selection dialog

SelectionDialog Simple selection dialog inspired from ios-custom-alertview Preview Requirements iOS 8.0+ Swift 3 Xcode 8.0 Installation CocoaPods use_

Lee Sun-Hyoup 117 Aug 5, 2022
PopupWindow is a simple Popup using another UIWindow in Swift

PopupWindow PopupWindow is a simple Popup using another UIWindow Feature PopupWindow can be displayed at the top or bottom of the screen. Popup can se

shinji hayashi 415 Dec 5, 2022
The library allows to create simple popup menus

react-native-popup-menu This library allows to create simple popup menus Installation "react-native-popup-menu": "sergeymild/react-native-popup-menu"

SergeyMild 0 Aug 20, 2022
IAMPopup is a simple class for expressing custom popup in various forms.

IAMPopup Introduction IAMPopup is a simple class for expressing custom popup in various forms. This includes where to display the popup and space to d

Hosung Kang 18 Dec 29, 2022
Toasts and popups library written with SwiftUI

Popup View Toasts and popups library written with SwiftUI We are a development agency building phenomenal apps. Usage Put all your body code into a ZS

Exyte 1.9k Jan 6, 2023
🍞 Toast for Swift - Toaster Android-like toast with very simple interface

Toaster Android-like toast with very simple interface. (formerly JLToast) Screenshots Features Queueing: Centralized toast center manages the toast qu

Suyeol Jeon 1.6k Jan 3, 2023
A simple way to show toast in SwiftUI.

A simple way to show toast in SwiftUI Documentation • Example • Change Log Overview ToastUI provides you a simple way to present toast, head-up displa

Quan Tran 384 Dec 29, 2022
ToastSwiftUI-master - A simple way to show a toast or a popup in SwiftUI

ToastSwiftUI-master - A simple way to show a toast or a popup in SwiftUI

Kushal Shingote 2 May 25, 2022
A simple solution to show a toast message by writing single one line of code

easySwiftToast A very simple solution to show a toast message by writing single one line of code. Installation easySwiftToast is available through Coc

wajeehulhassan 7 May 13, 2022
SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.

SSToastMessage SSToastMessage is written in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to b

Simform Solutions 223 Dec 2, 2022
A Simple Toast Library for iOS

PowerplayToastKit Toasts Type Success. Warning Error Info Custom View (Dialog) Example To run the example project, clone the repo, and run pod install

Mithilesh Parmar 18 Jul 2, 2022
Mahmoud-Abdelwahab 5 Nov 23, 2022
Show the confetti only when the user is having fun, and if not having fun, don't show it.

SPConfetti - A simple solution to show the confetti to the user. Smoothly starts and stops. Allow set multiply diffrent particles at once. You can chang

Ivan Vorobei 225 Dec 30, 2022
A fully customizable library to easily display Animated Toast Messages in iOS using Swift!

CustomToastView-swift A fully customizable library to easily display Animated Toast Messages in iOS using Swift! Preview - All the custom toasts you c

Leticia Rodriguez 13 Aug 20, 2022
A Swift Toast view - iOS 14 style and newer - built with UIKit. 🍞

Toast-Swift A Swift Toast view - iOS 14 style - built with UIKit. ?? Installation Swift Package Manager You can use The Swift Package Manager to insta

Bastiaan Jansen 216 Jan 4, 2023
A modern iOS toast view that can fit your notification needs

CRToast CRToast is a library that allows you to easily create notifications that appear on top of or by pushing out the status bar or navigation bar.

Collin Ruffenach 4.2k Dec 30, 2022