Skip to content

EgzonArifi/EAAlertView

Repository files navigation

EAAlertView

iOS Modern Style Alerts

Swift 4.0 Platform: iOS XCode 9+ iOS 11 Licence MIT

Alerts & Pickers

Alerts with TextField, TextView, DatePicker, PickerView

Usage

  • 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")

Date picker

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: " ")

Text View

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: "")

Installing

Cocoapods

pod 'EAAlertView'

Requirements

  • Swift 4
  • iOS 11 or higher

Authors

Communication

  • 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.

License

This project is licensed under the MIT License.