Add optional completion to message alert

This commit is contained in:
Ivan Grachyov 2021-12-11 18:31:06 +03:00
parent 655957e194
commit 2829ee470d

View File

@ -14,9 +14,11 @@ extension UIViewController {
dismiss(animated: true)
}
func showMessageAlert(text: String) {
func showMessageAlert(text: String, completion: (() -> Void)? = nil) {
let alert = UIAlertController(title: text, message: nil, preferredStyle: .alert)
let okAction = UIAlertAction.init(title: Strings.ok, style: .default)
let okAction = UIAlertAction(title: Strings.ok, style: .default) { _ in
completion?()
}
alert.addAction(okAction)
present(alert, animated: true)
}