Upon first downloading my app, I want to push a different view controller (such as a tutorial view controller), then after opened again, I want to push my normal view controller upon launching. In swift, the way I push a view controller is the following:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
window!.rootViewController = ViewController()
window!.makeKeyAndVisible()
return true
}
So intuitively, maybe something like this:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
if firstRun == true {
window!.rootViewController = LaunchViewController()
window!.makeKeyAndVisible()
} else {
window!.rootViewController = ViewController()
window!.makeKeyAndVisible()
}
return true
}