I have a problem with changing root in my app.
Design of my app.
After I login into app I would like to change root vc to UITabBarViewController
to clean a stack.
I've faced multiple problems.
Setting vc to tab bar on apply login action -> or in bottom vc:
self.performSegue(withIdentifier: "goToMainTabBar", sender: nil) override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if let vc = segue.destination as? TabBarViewController { UIApplication.shared.keyWindow?.rootViewController = vc } }
The app going to crash with:
Application tried to present modal view controller on itself. Presenting controller is TabBarViewController
Next problem is if we set a root in
TabBarViewController
viewDidLoaded
.UIApplication.shared.keyWindow?.rootViewController = self
Tab bar items embaded in UINavigationController
doesnt have Navigation controller in it selfs, so the nav vc is not instantiated ? Becouse wheenver I will enter into item vc child -> I can't back any more.
If i won;t change a root vc there everything is fine.