ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - devxoul/Toaster: ๐Ÿž Toast for Swift
๐Ÿž Toast for Swift. Contribute to devxoul/Toaster development by creating an account on GitHub.
Visit Site

GitHub - devxoul/Toaster: ๐Ÿž Toast for Swift

GitHub - devxoul/Toaster: ๐Ÿž Toast for Swift

Toaster

Build Status Swift CocoaPods Carthage compatible

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

Screenshots

Toaster Screenshot

Features

  • Queueing: Centralized toast center manages the toast queue.
  • Customizable: See the Appearance section.
  • String or AttributedString: Both supported.
  • UIAccessibility: VoiceOver support.

At a Glance

import Toaster

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

Compatibility

Toaster supports the same minimum Xcode version as App Store submission (https://developer.apple.com/ios/submit/):

  • Xcode 15 and newer

Toaster supports the same Swift versions as Xcode (https://developer.apple.com/support/xcode/):

  • Swift 4 and newer

Toaster supports all Apple platforms.

Installation

  • For projects with CocoaPods:

    pod 'Toaster'
    
  • For projects with Carthage:

    github "devxoul/Toaster"
    
  • For projects with Swift Package Manager:

    dependencies: [
        .package(url: "https://github.com/devxoul/Toaster.git", from: "master")
    ]
    

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:

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

    if let 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:

Property Type Description
backgroundColor UIColor Background color
cornerRadius CGFloat Corner radius
textInsets UIEdgeInsets Text inset
textColor UIColor Text color
font UIFont Font
bottomOffsetPortrait CGFloat Vertical offfset from bottom in portrait mode
bottomOffsetLandscape CGFloat Vertical offfset from bottom in landscape mode
shadowPath CGPath The shape of the layerโ€™s shadow
shadowColor UIColor The color of the layerโ€™s shadow
shadowOpacity Float The opacity of the layerโ€™s shadow
shadowOffset CGSize The offset (in points) of the layerโ€™s shadow
shadowRadius CGFloat The blur radius (in points) used to render the layerโ€™s shadow
maxWidthRatio CGFloat The width ratio of toast view in window
useSafeAreaForBottomOffset Bool A Boolean value that determines safeAreaInsets.bottom is added to bottomOffset

Attributed string

Since Toaster 2.3.0, you can also set an attributed string:

Toast(attributedText: NSAttributedString(string: "AttributedString Toast", attributes: [NSAttributedString.Key.backgroundColor: UIColor.yellow]))

Accessibility

By default, VoiceOver with UIAccessibility is enabled since Toaster 2.3.0. To disable it:

ToastCenter.default.isSupportAccessibility = false

License

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

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory