Closed jlandon closed 7 years ago
A few simple extensions on UIAlertController
Individual examples:
controller.addAction(UIAlertAction(title: "Ok", style: .default)) // before controller.addAction(title: "Ok") // after UIAlertController(title: "Title", message: nil, preferredStyle: .alert) // before UIAlertController.alert(title: "Title") // after UIAlertController(title: "Title", message: nil, preferredStyle: .actionSheet) // before UIAlertController.actionSheet(title: "Title") // after UIViewController.current?.present(controller, animated: true) // before controller.present() // after
Full example:
// before let controller = UIAlertController(title: "Title", message: nil, preferredStyle: .alert) controller.addAction(UIAlertAction(title: "Ok", style: .default)) controller.addAction(UIAlertAction(title: "Cancel", style: .cancel)) UIViewController.current?.present(controller, animated: true) // after UIAlertController.alert(title: "Title") .addAction(title: "Ok") .addAction(title: "Cancel", style: .cancel) .present()
Or you COULD just use HEAlert 😁
We'll leave the PR open for a couple more days, in case anyone else has comments.
A few simple extensions on UIAlertController
Individual examples:
Full example: