Skip to content

Instantly share code, notes, and snippets.

@aprofromindia
Last active December 20, 2019 12:55
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 aprofromindia/4c3a752f5a573ec90556226fd0a563bb to your computer and use it in GitHub Desktop.
Save aprofromindia/4c3a752f5a573ec90556226fd0a563bb to your computer and use it in GitHub Desktop.
UIViewController instantiate ViewController from Storyboard with same name
//
// Created by Apro on 04/12/19.
//
import UIKit
extension UIViewController {
func instantiateVC<VC: UIViewController>(storyboardId: String? = nil) -> VC {
return storyboard?.instantiateViewController(withIdentifier: storyboardId ?? String(describing: VC.self)) as! VC
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment