Skip to content

Instantly share code, notes, and snippets.

@mbigatti
Created July 10, 2014 15:40
Show Gist options
  • Save mbigatti/807a65dfb09f7b442585 to your computer and use it in GitHub Desktop.
Save mbigatti/807a65dfb09f7b442585 to your computer and use it in GitHub Desktop.
A classical first responder finder using Swift.
import UIKit
extension UIView {
func currentFirstResponder() -> UIResponder? {
if self.isFirstResponder() {
return self
}
for view in self.subviews {
if let responder = view.currentFirstResponder() {
return responder
}
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment