Skip to content

Instantly share code, notes, and snippets.

@KanshuYokoo
Created March 27, 2019 18:45
Show Gist options
  • Save KanshuYokoo/03aefa7c42905298df0827f8a69964fb to your computer and use it in GitHub Desktop.
Save KanshuYokoo/03aefa7c42905298df0827f8a69964fb to your computer and use it in GitHub Desktop.
ios, Xocde, swift, Open View from storyboard programatically on AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Assume there are firstView and SecondView in the Main.storyboard
// open SecondView
window = UIWindow(frame: UIScreen.main.bounds)
let storyboad: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyboad.instantiateViewController(withIdentifier: "SecondView") as UIViewController
window!.rootViewController = newViewController
window!.makeKeyAndVisible()
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment