ARAlertViewController
Requirements
- iOS 9.0
- Xcode 11.0+
- Swift 5+
Installation
ARAlertViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ARAlertViewController'
Then, run the following command:
pod install
Usage
Import
import ARAlertViewController
Initialization
Then Go to your viewController and call as following:
to show default alert without completion block
self.showAlert(title: "Alert", message: "Add a message you want to show", btnTitle: "OK", alertType: .defaultAlert)
with completion block
self.showAlert(title: "Alert", message: "Add a message you want to show", btnTitle: "OK", alertType: .defaultAlert) {
print("User clicked on ok button")
}
to show Custom alert without completion block
self.showAlert(title: "Alert", message: "Add a message you want to show", btnTitle: "OK", alertType: .customAlert)
with completion block
self.showAlert(title: "Alert", message: "Add a message you want to show", btnTitle: "OK", alertType: .customAlert) {
print("User clicked on ok button")
}
there are other helpper function avalible to show alert for Error
and Success
to show Error
self.showErrorAlertWithMessage(message: "add error message here", alertType: .customAlert) {
print("User clicked on Default Error ok button")
}
and to show Success
self.showSuccessAlertWithMessage(message: "Add you Success message there", alertType: .customAlert) {
print("User clicked on success ok button")
}
Author
AbdulRehman Warraich, [email protected]
License
ARAlertViewController is released under the MIT license. See LICENSE for details.