Skip to content

Repository files navigation

Toaster

Build StatusSwiftCocoaPodsCarthage compatible

Android-like toast with very simple interface. (formerly JLToast)

Toaster is written in Swift 3.0. If you're looking for Swift 2 compatible version, see the JLToast 1.4.2.

Features

  • Queueing: Centralized toast center manages the toast queue.
  • Customizable: See the Appearance section.

At a Glance

import Toaster
Toast(text:"Hello, world!").show()

Installation

  • For iOS 8+ projects with CocoaPods:

    pod'Toaster'
  • For iOS 8+ projects with Carthage:

    github "devxoul/Toaster"
    

Getting Started

Setting Duration and Delay

Toast(text:"Hello, world!", duration:Delay.long)Toast(text:"Hello, world!", delay:Delay.short, duration:Delay.long)

Removing Toasts

  • Removing toast with reference:

    lettoast=Toast(text:"Hello")
    toast.show()
    toast.cancel() // remove toast immediately
  • Removing current toast:

    iflet currentToast =ToastCenter.default.currentToast {
    currentToast.cancel()}
  • Removing all toasts:

    ToastCenter.default.cancelAll()

Appearance

Since Toaster 2.0.0, you can use UIAppearance to set default appearance. This is an short example to set default background color to red.

ToastView.appearance().backgroundColor =.red

Supported appearance properties are:

PropertyTypeDescription
backgroundColorUIColorBackground color
cornerRadiusCGFloatCorner radius
textInsetsUIEdgeInsetsText inset
textColorUIColorText color
fontUIFontFont
bottomOffsetPortraitCGFloatVertical offfset from bottom in portrait mode
bottomOffsetLandscapeCGFloatVertical offfset from bottom in landscape mode

Screenshots

Toaster Screenshot

License

Toaster is under WTFPL. You can do what the fuck you want with Toast. See LICENSE file for more info.

About

🍞 Toast for Swift

Resources

Stars

0 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages