Last active
December 4, 2016 10:19
-
-
Save andyyhope/eb2a5794f65db8d0ff97 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 instantiateViewController<T: UIViewController>() -> T where T: StoryboardIdentifiable { | |
guard let viewController = self.instantiateViewController(withIdentifier: T.storyboardIdentifier) as? T else { | |
fatalError("Couldn't instantiate view controller with identifier \(T.storyboardIdentifier) ") | |
} | |
return viewController | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment