Skip to content

Instantly share code, notes, and snippets.

@ibrennan
Created January 24, 2015 20:55
Show Gist options
  • Save ibrennan/8d2d0edf0f92591d1a6a to your computer and use it in GitHub Desktop.
Save ibrennan/8d2d0edf0f92591d1a6a to your computer and use it in GitHub Desktop.
Swift - Initiate new view controller from AppDelegate
// Name of storyboard, without the .storyboard extension
var storyboard = UIStoryboard(name: "Main", bundle: nil)
// The type is the view controller class name, in this case 'ViewControllerLaunch'
// You need to make sure the view controller in storyboard has an identifier set
// The identifier in this example is 'Launch'
var viewController: ViewControllerLaunch = storyboard.instantiateViewControllerWithIdentifier("Launch") as ViewControllerLaunch
// Show this view controller
window?.rootViewController = viewController
window?.makeKeyAndVisible()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment