In my appdelegate I want to check if globUs.hasName
. If it does I want the Entry Point
of the app to be my main
storyboard. If it does not I want the Entry Point
of the app to be my newUser
storyboard. How do I set the entry point of the app? If I can't, what is the most effective way to implement this functionality?
Consider not having an entry point. Then, in appDelegate, test for your variable and choose the appropriate storyboard accordingly. Then show the view controller from that storyboard.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if globUs.hasName {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "FirstMainVC")
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = new
self.window?.makeKeyAndVisible()
}
else {
let storyboard = UIStoryboard(name: "NewUser", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "FirstNewUserVC")
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = welcomeVC
self.window?.makeKeyAndVisible()
}
return true
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With