Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension UIViewController {
- func presentInfoAlert(_ viewcontroller: UIViewController, withTitle title: String = "", message : String, completion: ((String) -> Swift.Void)? = nil) {
- let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
- let OKAction = UIAlertAction(title: "확인", style: .default) { action in
- if completion != nil {
- completion!("OK")
- }
- }
- alertController.addAction(OKAction)
- viewcontroller.present(alertController, animated: true, completion: nil)
- }
- func presentComformAlert(_ viewcontroller: UIViewController, withTitle title: String = "", cancel: String = "취소", ok: String = "확인", message : String, completion: ((String) -> Swift.Void)? = nil) {
- let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
- let CancelAction = UIAlertAction(title: cancel, style: .default) { action in
- if completion != nil {
- completion!("Cancel")
- }
- }
- let OKAction = UIAlertAction(title: ok, style: .default) { action in
- if completion != nil {
- completion!("OK")
- }
- }
- alertController.addAction(CancelAction)
- alertController.addAction(OKAction)
- viewcontroller.present(alertController, animated: true, completion: nil)
- }
- }
Add Comment
Please, Sign In to add comment