-
-
Save adamnemecek/82facd9bee446de94a26cfd0cc195625 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
func responderForType<T>(from: UIResponder) -> T? { | |
var current = from | |
while let next = current.nextResponder() { | |
if let result = next as? T { return result } | |
current = next | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment