Similar to an UIAlertController
, a toast is displayed in a separate UIWindow
.
This means that itβs presented on top of everything, regardless the view hierarchy.
To integrate JDToaster
into your Xcode project using CocoaPods
, specify it in your Podfile
:
pod 'JDToaster'
Then, run the following command:
pod install
If you prefer not to use any of the dependency managers, you can integrate JDToaster
into your project manually, by downloading the source code and placing the files on your project directory.
Toaster.default.show(text: βHello Toast!β)
Toaster.default.dismiss(animated: true)
Property | Type | Default | Description |
---|---|---|---|
backgroundColor |
UIColor |
.black |
Background colour of the toast |
font |
UIFont |
.systemFont(ofSize: 17, weight: .medium) |
Font of the presented text |
textColor |
UIColor |
.white |
Colour of the presented text |
textInsets |
UIEdgeInsets |
UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0) |
Insets of the text within the toast |
cornerRadius |
CGFloat |
8.0 |
Corner radius of the toast |
bottomPadding |
CGFloat |
16.0 |
The space between the toast bottom board and the bottom |
minimumHorizontalPadding |
CGFloat |
24.0 |
The minimum space between the toast left/right board and the view. |
Checkout the Example project
- Toaster by @devxoul
- Squawk by @_ryannystrom
- Custom View Controller Presentation Tips & Tricks by @kylebshr
This tiny library is created with β€οΈ by Joan Disho.
JDToaster
is released under an MIT license. See License.md for more information.