![CI Status](https://img.shields.io/travis/Lê Văn Sơn/KToasty.svg?style=flat)
KToasty is a lightweight and customizable toast library for iOS applications. It provides a simple way to display informative messages in your app.
- iOS 12.0+
KToasty is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'KToasty'
Display a Simple Toast To display a simple toast message, instantiate a Toasty object and call the show method:
import KToasty
let toasty = Toasty(message: "Hello World!", sender: self)
toasty.show()
You can also use NSMutableAttributedString to add some icon for ex:
import KToasty
let attrString = NSMutableAttributedString(string:"Hi world!")
let imageAttachment = NSTextAttachment()
imageAttachment.image = UIImage(name: "wave")
imageAttachment.bounds = CGRect(x: 0, y: -8, width: 25, height: 25)
let imageString = NSAttributedString(attachment: imageAttachment)
attrString.append(imageString)
Toasty(messageAttribuleString: attrString, sender: self).show()
You can customize the duration of the toast and its visual style:
let toasty = Toasty(message: "Customized Toast", sender: self, style: .success)
toasty.show(duration: .long)
You can specify whether the toast should appear at the top or bottom of the screen:
let toasty = Toasty(message: "Top Toast", sender: self)
toasty.show(position: .top)
To show toasts in a queue, use the ShowMode.queue option:
let toasty1 = Toasty(message: "Toast 1", sender: self)
let toasty2 = Toasty(message: "Toast 2", sender: self)
toasty1.show(showMode: .queue)
toasty2.show(showMode: .queue)
To run the example project, clone the repo, and run pod install
from the Example directory first.
Lê Văn Sơn, 69423922+kiluss2@users.noreply.github.com
KToasty is available under the MIT license. See the LICENSE file for more info.