TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2016 |
SPMSupports SPM | ✗ |
Maintained by Ahmad Athaullah.
Simple Swift in-app toast notification
Function to show default toast notification:
QToasterSwift.toast(target: UIViewController, text: String, title: String?, iconURL: String?, iconPlaceHolder: UIImage?, backgroundColor: UIColor?, textColor: UIColor?, onTouch: () -> Void)
all optional parameters can be removed
Show toaster with message (without title and other parameters):
QToasterSwift.toast(self, text: "Welcome to QToasterSwift")
Show toaster with message and title only:
QToasterSwift.toast(self, text: "Welcome to QToasterSwift", title: "Welcome")
Show toaster with icon UIImage and/or Image icon from URL:
let image = UIImage(named:"my-image")
QToasterSwift.toastWithIcon(self, text: "Welcome to QToasterSwift", icon: image, title: "Welcome")
let placeholderImage = UIImage(named: "placeholder-image")
let iconUrl = "https://my-icon-url/icon.jpg"
QToasterSwift.toast(self,
text: "Welcome to QToasterSwift",
title: "Welcome",
iconURL: iconUrl,
iconPlaceHolder: placeholderImage)
More complex basic toaster with onTouch action:
let placeholderImage = UIImage(named: "placeholder-image")
let iconUrl = "https://my-icon-url/icon.jpg"
QToasterSwift.toast(self,
text: "Welcome to QToasterSwift sample usage code",
title: "Welcome",
iconURL: iconUrl,
iconPlaceHolder: placeholderImage,
backgroundColor: UIColor.redColor(),
textColor: UIColor.whiteColor(),
onTouch: {
print("toaster touched")
}
)
QToasterSwift also support more configurable styling parameters.
let placeholderImage = UIImage(named: "placeholder-image")
let iconUrl = "https://my-icon-url/icon.jpg"
let toaster = QToasterSwift()
toaster.textAlignment = NSTextAlignment.Center
toaster.textFont = UIFont.systemFontOfSize(11.0)
toaster.titleFont = UIFont.systemFontOfSize(11.0, weight: 0.8)
toaster.titleText = "Welcome"
toaster.text = "Welcome to QToasterSwift sample usage code"
toaster.iconImage = placeholderImage
toaster.iconURL = iconUrl
toaster.backgroundColor = UIColor.blueColor()
toaster.textColor: UIColor = UIColor.whiteColor()
toaster.animateDuration = 0.1
toaster.delayDuration = 3.0
toaster.iconSquareSize = 30.0
toaster.iconCornerRadius = 5.0
toaster.iconBackgroundColor = UIColor.blackColor()
toaster.toast(self) // self is your view controller
toaster.toast(self, onTouch: {
print("toaster touched")
})
Please support us with your contribution and/or give us star to keep track this repository for any update. Thanks.