a guest Aug 18th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extension UIViewController
  2. {
  3.     static func instantiate<ViewController: UIViewController>(_ storyboardName: UIStoryboard.Name,
  4.                                                               _ viewControllerType: ViewController.Type) -> ViewController
  5.     {
  6.         let storyboard = UIStoryboard(name: storyboardName.rawValue, bundle: nil)
  7.         return storyboard.instantiateViewController(withIdentifier: String(describing: ViewController.self)) as! ViewController
  8.     }
  9. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand