I'm using a Tab Bar Controller
, it works fine, but when my app first starts with my Onboarding Screen for the users to accept the T&Cs, the tab bar disappears.
I'm not too sure what to do here. Here's my code:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
//tnc screen ----------------------------------------------
let launchedBefore = UserDefaults.standard.bool(forKey: "hasLaunched")
self.window = UIWindow(frame: UIScreen.main.bounds)
let launchStoryboard = UIStoryboard(name: "Onboarding", bundle: nil)
let mainStoryboard = UIStoryboard (name: "Main", bundle: nil)
var vc: UIViewController
if launchedBefore {
vc = mainStoryboard.instantiateInitialViewController()!
} else {
vc = launchStoryboard.instantiateViewController(withIdentifier: "FirstLaunch")
}
UserDefaults.standard.set(true, forKey: "hasLaunched")
self.window?.rootViewController = vc
self.window?.makeKeyAndVisible()
//end tnc screen ---------------------------------------------
How should I fix this?