-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAlertHelper.swift
More file actions
30 lines (21 loc) · 1.08 KB
/
AlertHelper.swift
File metadata and controls
30 lines (21 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// AlertHelper.swift
//
// Created by Luís Machado on 18/11/16.
// Copyright © 2016 LuisMachado. All rights reserved.
//
import Foundation
import UIKit
class AlertHelper {
static func displayAlert(title: String, message: String, displayTo: UIViewController) {
let alert = UIAlertController(title: title, message: message , preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
displayTo.present(alert, animated: true, completion: nil)
}
static func displayAlertCancel(title: String, message: String, displayTo: UIViewController, okCallback: @escaping (UIAlertAction) -> Void) {
let alert = UIAlertController(title: title, message: message , preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: .destructive, handler: okCallback))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
displayTo.present(alert, animated: true, completion: nil)
}
}