Skip to content

Instantly share code, notes, and snippets.

@c16a
Last active March 7, 2017 10:22
Show Gist options
  • Select an option

  • Save c16a/c64e2c91a4d9d84b5c03dab4afc47ce4 to your computer and use it in GitHub Desktop.

Select an option

Save c16a/c64e2c91a4d9d84b5c03dab4afc47ce4 to your computer and use it in GitHub Desktop.

Revisions

  1. c16a revised this gist Mar 7, 2017. 2 changed files with 10 additions and 7 deletions.
    7 changes: 0 additions & 7 deletions AppDelegate.swift
    Original file line number Diff line number Diff line change
    @@ -1,7 +0,0 @@
    func applyFirstResponder() {
    let dummyField = UITextField()
    self.window?.addSubView(dummyField)
    dummyField.becomeFirstResponder()
    dummyField.resignFirstResponder()
    dummyField.removeFromSuperview()
    }
    10 changes: 10 additions & 0 deletions workaround.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    // 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()
    }
  2. c16a revised this gist Mar 7, 2017. No changes.
  3. c16a created this gist Mar 7, 2017.
    7 changes: 7 additions & 0 deletions AppDelegate.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    func applyFirstResponder() {
    let dummyField = UITextField()
    self.window?.addSubView(dummyField)
    dummyField.becomeFirstResponder()
    dummyField.resignFirstResponder()
    dummyField.removeFromSuperview()
    }