SKAlert
Alerts in iOS might be painful when it comes to writing multiple lines of code and has reusabilty issues. For that matter we have created SKAlert
for simpler usage of alerts for iOS.
Requirements
SKAlert
works for iOS 9.0+ and requires ARC to buid.
Add SKAlert to your project
Cocoapods ( Highly recommended way is to use cocoapods)
pod 'SKAlert'
Static library
Follow this article at Medium. But before continuing with the above article, delete Example project.
Usage:
- import SKAlert
- Start Using It, by below sytax
_ = SKAlert().showAlert("Plain Alert Header.", subTitle: "Plain Alert Sub Title")
_ = SKAlert().showAlertWithOkAction("Alert Header", subTitle: "Alert Sub Title", okCompletionHandler: {
print("Ok Pressed")
})
_ = SKAlert().showAlertWithTwoButtons("Alert Header With Two Buttons", subTitle: "Alert Sub Title With Two Buttons", okCompletionHandler: {
print("Ok Pressed")
}, cancelCompletionHandler: {
print("Canel Pressed")
})
_ = SKAlert().showAlertWithCustomButtons("Alert Header With Two Custom Buttons", subTitle: "Sub title with custom buttons with Handlers........!!!", leftBtnTitle: "Left", leftBtnColor: UIColor.black, rightBtnTitle: "right", rightBtnColor: UIColor.red, leftCompletionHandler: {
print("left")
}) {
print("right")
}
let alert = SKAlert()
alert.isTapToDismiss = false
alert.showAlert("Plain Alert Header.", subTitle: "Plain Alert Sub Title")
Noticeable mentions
- SweetAlert
- Medium article
License
This code is distributed under the terms and conditions of the MIT license.
Change-log
A brief summary of each release can be found in the CHANGELOG.