simplify alert code
This commit is contained in:
parent
5ed3629c52
commit
edfd8c97a7
7 changed files with 21 additions and 40 deletions
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
import SwiftyUserDefaults
|
||||
import UIKit
|
||||
|
||||
class Utils {
|
||||
static func removeFileIfExists(atPath path: String) {
|
||||
|
|
@ -50,6 +51,13 @@ class Utils {
|
|||
|
||||
return randomString
|
||||
}
|
||||
|
||||
static func alert(title: String, message: String, controller: UIViewController, completion: (() -> Void)?) {
|
||||
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||
controller.present(alert, animated: true, completion: completion)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// https://gist.github.com/NikolaiRuhe/eeb135d20c84a7097516
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue