From 417db5a7991dc210b1f9e251ba86f7772a362044 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 25 Sep 2019 16:02:25 +0200 Subject: [PATCH] fix(ios): make programmatically focus work on iOS 13 --- ios/Capacitor/Capacitor/CAPBridgeViewController.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ios/Capacitor/Capacitor/CAPBridgeViewController.swift b/ios/Capacitor/Capacitor/CAPBridgeViewController.swift index a8fbeb0be5..22a3fe204c 100644 --- a/ios/Capacitor/Capacitor/CAPBridgeViewController.swift +++ b/ios/Capacitor/Capacitor/CAPBridgeViewController.swift @@ -286,6 +286,7 @@ public class CAPBridgeViewController: UIViewController, CAPBridgeDelegate, WKScr let oldSelector: Selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:userObject:") let newSelector: Selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:") let newerSelector: Selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:") + let ios13Selector: Selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:") if let method = class_getInstanceMethod(wkc, oldSelector) { let originalImp: IMP = method_getImplementation(method) @@ -304,6 +305,10 @@ public class CAPBridgeViewController: UIViewController, CAPBridgeDelegate, WKScr if let method = class_getInstanceMethod(wkc, newerSelector) { self.swizzleAutofocusMethod(method, newerSelector, value) } + + if let method = class_getInstanceMethod(wkc, ios13Selector) { + self.swizzleAutofocusMethod(method, ios13Selector, value) + } } func swizzleAutofocusMethod(_ method: Method, _ selector: Selector, _ value: Bool) {