Latest | 1.0.1 |
---|---|
Homepage | https://github.com/hypery2k/toastr |
License | WTPFL |
Platforms | ios 8.0, requires ARC |
Frameworks | UIKit, Foundation, QuartzCore |
Authors |
Toaster
Android-like toast with very simple interface. (formerly JLToast)
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 'toastr'
-
For iOS 8+ projects with Carthage:
github "hypery2k/toastr"
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
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.
Latest podspec
{ "name": "Toastr", "version": "1.0.1", "summary": "Toast for Swift", "homepage": "https://github.com/hypery2k/toastr", "license": { "type": "WTPFL", "file": "LICENSE" }, "authors": { "hypery2k": "[email protected]" }, "source": { "git": "https://github.com/hypery2k/toastr.git", "tag": "v1.0.1" }, "platforms": { "ios": "8.0" }, "source_files": "Sources/*.{swift,h}", "frameworks": [ "UIKit", "Foundation", "QuartzCore" ], "requires_arc": true }
Sat, 02 Mar 2019 11:02:04 +0000