Skip to content

Instantly share code, notes, and snippets.

@motokiee
Last active August 29, 2015 14:20
Show Gist options
  • Save motokiee/89191a8b78b73a734834 to your computer and use it in GitHub Desktop.
Save motokiee/89191a8b78b73a734834 to your computer and use it in GitHub Desktop.
UIStroyboard Extension
extension UIStoryboard {
/**
StoryboardからUIViewControllerを取り出す
:param: storyboardName 取り出すstoryboard名
:param: viewControllerName 取り出したいviewcontroller名
:returns: viewController
*/
class func instantiateViewController(storyboardName: String, viewControllerName: String) -> UIViewController {
let stroyboard = UIStoryboard(name: storyboardName, bundle: nil)
let viewController: UIViewController
= stroyboard.instantiateViewControllerWithIdentifier(viewControllerName) as! UIViewController
return viewController
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment