🍞 Toast for Swift Edit

Add topics
188 commits
3 branches
26 releases
13 contributors
Swift 92.3% Objective-C 4.0% Ruby 3.7%
Swift Objective-C Ruby
Clone or download Create new file Upload files Find file Branch: master New pull request
Pull request Compare This branch is even with devxoul:master.
Latest commit 6031f76 on Feb 16 devxoul Bump version to 2.0.3
Demo Modernize code 8 months ago
Screenshots JLToast is now Toaster 8 months ago
Sources fixing inifinite recursion on Tests with an Host Application where th… 3 months ago
Supporting Files JLToast is now Toaster 8 months ago
Toaster.xcodeproj fix Xcode 8.3 deprecation warning 3 months ago
.gitignore Used [[UIApplication sharedApplication] statusBarOrientation] instead… 4 years ago
.swift-version Add .swift-version 8 months ago
.travis.yml Remove obsolete config 7 months ago
LICENSE Change year of LICENSE 2 years ago
README.md Bump version to 2.0.3 3 months ago
Toaster.podspec Bump version to 2.0.3 3 months ago
README.md
Toaster

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’, ‘~> 2.0’
For iOS 8+ projects with Carthage:

github “devxoul/Toaster” ~> 2.0
For iOS 7 projects: I recommend you to try CocoaSeeds, which uses source code instead of dynamic frameworks. Sample Seedfile:

github ‘devxoul/Toaster’, ‘2.0.3’, :files => ‘Sources/*.{swift,h}’
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
Screenshots

License

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

https://github.com/barkinet/Toaster

Advertisements