Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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