WMAlertController
Requirement
- iOS 9.0+
- Swift 4.0+
Installation
WMAlertController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'WMAlertController'
About
WMAlertController is a fully customizable alert controller that functions like the familiar UIAlertController.
Using the provided WMAlertStyle, you can modify the following attributes:
- overlayBackgroundColor
- backgroundColor
- cornerRadius
- titleFont
- titleTextColor
- titleNumberOfLines
- messageFont
- messageTextColor
- messageNumberOfLines
- separatorColor
- titleAttributes
- messageAttributes
Usage
let alertController = WMAlertController(
title: "Confirmation",
message: "Example Alert Controller",
style: .light,
decoration: .none
)
alertController.addAction(WMAlertAction(title: "Cancel", handler: { (action) in
action.alert?.dismiss(animated: true, completion: nil)
}))
alertController.addAction(WMAlertAction(title: "Do the action", handler: { (action) in
action.alert?.dismiss(animated: true, completion: {
// Do some work...
})
}))
self.present(alertController, animated: true, completion: nil)
License
WMAlertController is available under the ASLv2 license. See the LICENSE file for more info.