Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): make programmatically focus work on iOS 13 #1995

Merged
merged 1 commit into from
Sep 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ios/Capacitor/Capacitor/CAPBridgeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand Down