Created
June 15, 2016 14:14
-
-
Save ianterrell/5aa139ab4b835b85cfee8e0f4430b863 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// This handles most storyboard style injection needs | |
extension UIViewController { | |
func injectable<T>() -> T? { | |
var controller: UIViewController? = self | |
if let nav = self as? UINavigationController { | |
controller = nav.viewControllers.first | |
} | |
return controller as? T | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment