Add confirmation prompt for removing keys (fix #491)
This commit is contained in:
parent
7320319031
commit
ff6a1edf62
7 changed files with 42 additions and 9 deletions
|
|
@ -28,6 +28,10 @@ public extension UIAlertAction {
|
|||
UIAlertAction(title: "Ok".localize(), style: .default, handler: handler)
|
||||
}
|
||||
|
||||
static func remove(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
||||
UIAlertAction(title: "Remove".localize(), style: .destructive, handler: handler)
|
||||
}
|
||||
|
||||
static func okAndPopView(controller: UIViewController) -> UIAlertAction {
|
||||
ok { _ in
|
||||
controller.navigationController?.popViewController(animated: true)
|
||||
|
|
|
|||
17
passKit/Extensions/UIAlertControllerExtension.swift
Normal file
17
passKit/Extensions/UIAlertControllerExtension.swift
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// UIAlertControllerExtension.swift
|
||||
// passKit
|
||||
//
|
||||
// Copyright © 2021 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public extension UIAlertController {
|
||||
class func removeConfirmationAlert(title: String, message: String, handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertController {
|
||||
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.remove(handler: handler))
|
||||
alert.addAction(UIAlertAction.cancel())
|
||||
return alert
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue