Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created March 30, 2019 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/a7c5470ba332c9157215d57869dd99c7 to your computer and use it in GitHub Desktop.
Save laevandus/a7c5470ba332c9157215d57869dd99c7 to your computer and use it in GitHub Desktop.
extension UIStoryboard {
func instantiateViewController<T: UIViewController>(withType type: T.Type) -> T {
let className = NSStringFromClass(type).split(separator: ".").last!
return instantiateViewController(withIdentifier: String(className)) as! T
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment