Skip to content

Instantly share code, notes, and snippets.

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