Created
March 24, 2016 10:39
-
-
Save robnadin/febdede52d34d564a8af to your computer and use it in GitHub Desktop.
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
import UIKit | |
extension UIResponder { | |
private weak static var _currentFirstResponder: UIResponder? | |
static var currentFirstResponder: UIResponder? { | |
get { | |
_currentFirstResponder = nil | |
UIApplication.sharedApplication().sendAction(#selector(findFirstResponder), to: nil, from: nil, forEvent: nil) | |
return _currentFirstResponder | |
} | |
set { | |
_currentFirstResponder = newValue | |
} | |
} | |
@objc private func findFirstResponder() { | |
UIResponder.currentFirstResponder = self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment