/*
 |  _   ____   ____   _
 | | |‾|  ⚈ |-| ⚈  |‾| |
 | | |  ‾‾‾‾| |‾‾‾‾  | |
 |  ‾        ‾        ‾
 */

import UIKit

public extension UIAlertController {
    
    public func addCancel(handler: ((UIAlertAction) -> Void)? = nil) {
        addAction(customAction(with: NSLocalizedString("Cancel", comment: "Cancel button title"), handler: handler))
    }
    
    public func addOK(handler: ((UIAlertAction) -> Void)? = nil) {
        let action = customAction(with: NSLocalizedString("OK", comment: "OK button title"), handler: handler)
        addAction(action)
        preferredAction = action
    }
    
    private func customAction(with title: String, handler: ((UIAlertAction) -> Void)?) -> UIAlertAction {
        let finalHandler = handler ?? { _ in
            if #available(iOS 10.0, *) {
                UIImpactFeedbackGenerator(style: .light).impactOccurred()
            }
        }
        return UIAlertAction(title: title, style: .cancel, handler: finalHandler)
    }
    
}

/*
 |  _   ____   ____   _
 | | |‾|  ⚈ |-| ⚈  |‾| |
 | | |  ‾‾‾‾| |‾‾‾‾  | |
 |  ‾        ‾        ‾
 */

import UIKit

public extension UIAlertController {
    
    public func addCancel(handler: ((UIAlertAction) -> Void)? = nil) {
        addCustomAction(with: NSLocalizedString("Cancel", comment: "Cancel button title"), handler: handler)
    }
    
    public func addOK(handler: ((UIAlertAction) -> Void)? = nil) {
        addCustomAction(with: NSLocalizedString("OK", comment: "OK button title"), handler: handler)
    }
    
    private func addCustomAction(with title: String, handler: ((UIAlertAction) -> Void)?) {
        let finalHandler = handler ?? { _ in
            if #available(iOS 10.0, *) {
                UIImpactFeedbackGenerator(style: .light).impactOccurred()
            }
        }
        addAction(UIAlertAction(title: title, style: .cancel, handler: finalHandler))
    }
    
}

--- 
+++ 
@@ -10,20 +10,22 @@
 public extension UIAlertController {
     
     public func addCancel(handler: ((UIAlertAction) -> Void)? = nil) {
-        addCustomAction(with: NSLocalizedString("Cancel", comment: "Cancel button title"), handler: handler)
+        addAction(customAction(with: NSLocalizedString("Cancel", comment: "Cancel button title"), handler: handler))
     }
     
     public func addOK(handler: ((UIAlertAction) -> Void)? = nil) {
-        addCustomAction(with: NSLocalizedString("OK", comment: "OK button title"), handler: handler)
+        let action = customAction(with: NSLocalizedString("OK", comment: "OK button title"), handler: handler)
+        addAction(action)
+        preferredAction = action
     }
     
-    private func addCustomAction(with title: String, handler: ((UIAlertAction) -> Void)?) {
+    private func customAction(with title: String, handler: ((UIAlertAction) -> Void)?) -> UIAlertAction {
         let finalHandler = handler ?? { _ in
             if #available(iOS 10.0, *) {
                 UIImpactFeedbackGenerator(style: .light).impactOccurred()
             }
         }
-        addAction(UIAlertAction(title: title, style: .cancel, handler: finalHandler))
+        return UIAlertAction(title: title, style: .cancel, handler: finalHandler)
     }
     
 }
Set OK action as preferred
