iOS Modern Style Alerts
Alerts with TextField, TextView, DatePicker, PickerView
- New Alert
let alert = EAAlertView(appearance: appearance)
// or
let alert = EAAlertView()
- Set and styling message
let appearance = EAAlertView.EAAppearance(
kTextFieldHeight: 60,
kButtonHeight: 60,
showCloseButton: false,
shouldAutoDismiss: false
)
- Add button with image
alert.addAction(image: image, title: "Title", color: .black, style: .default) { action in
// completion handler
}
- Show Alert
// show alert
_ = alert.show("Title", subTitle: "subtitle")
let picker = UIDatePicker(frame: CGRect(x: 0, y: 0, width: self.view.frame.width*0.8, height: 200))
picker.datePickerMode = UIDatePickerMode.date
let appearance = EAAlertView.EAAppearance(kButtonHeight: 60, showCloseButton: false, shouldAutoDismiss: false)
let alert = EAAlertView(appearance: appearance)
alert.customSubview = picker
_ = alert.addButton(backgroundImage: image), "Select") {
alert.hideView()
}
_ = alert.show("Birthdate", subTitle: " ")
let appearance = EAAlertView.EAAppearance(kTextViewdHeight: self.view.frame.height*0.6, kButtonHeight: 60, showCloseButton: false, shouldAutoDismiss: false)
let alert = EAAlertView(appearance: appearance)
let textView = alert.addTextView()
textView.text = "text"
_ = alert.addButton(backgroundImage: image, "Accept") {
alert.hideView()
}
_ = alert.show("Terms", subTitle: "")
pod 'EAAlertView'
- Swift 4
- iOS 11 or higher
- Egzon Arifi - egzonarifi
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
This project is licensed under the MIT License.