Skip to content

Instantly share code, notes, and snippets.

@adamnemecek
Forked from mikeash/responder.swift
Created August 4, 2016 18:23
Show Gist options
  • Save adamnemecek/82facd9bee446de94a26cfd0cc195625 to your computer and use it in GitHub Desktop.
Save adamnemecek/82facd9bee446de94a26cfd0cc195625 to your computer and use it in GitHub Desktop.
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