Last active
March 7, 2017 10:22
-
-
Save c16a/c64e2c91a4d9d84b5c03dab4afc47ce4 to your computer and use it in GitHub Desktop.
Swift workaround to solve delay in assigning first UITextField responder in UIKit and erroneous responders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this function to the end of AppDelegate.swift | |
// Call this function in | |
// func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool | |
func applyFirstResponder() { | |
let dummyField = UITextField() | |
self.window?.addSubView(dummyField) | |
dummyField.becomeFirstResponder() | |
dummyField.resignFirstResponder() | |
dummyField.removeFromSuperview() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment