Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum AlertAction {
- case title(title: String)
- case titleWithPopAction (title: String)
- case titleWithSettingsAction (title: String)
- case titleWithAppStoreAction (title : String)
- case titleWithHandler (title: String, completionHandler: AlertControllerCompletionHandler?)
- var action: UIAlertAction {
- switch self {
- case let .title(title):
- return UIAlertAction(title: title, style: .default) { _ in }
- case let .titleWithPopAction(title):
- return UIAlertAction(title: title, style: .default) { _ in
- NavigationManager.shared.popVC() //Create Navigation manager class in your app which handles POP, PUSH, PRESENT VC.
- }
- case let .titleWithSettingsAction(title):
- return UIAlertAction(title: title, style: .default) { _ in
- NavigationManager.shared.popVC(animated: false)
- afterDelay(0.2) {
- UIApplication.shared.openURL(URL(string:"prefs:root")!)
- }
- }
- case let .titleWithAppStoreAction(title):
- return UIAlertAction(title: title, style: .default) { _ in
- afterDelay(0.2) {
- UIApplication.shared.openURL(URL(string: k_App_Store_url)!)
- }
- }
- case let .titleWithHandler(title, completionHandler):
- return UIAlertAction(title: title, style: .default) { action in
- completionHandler?(action)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement