I'm having some trouble with the logic in my application.
I have been looking for a way to change the navigation controller's viewcontroller stack.
For several reasons.
One, I have a login and sign up page, which each have buttons pushing to the other view controller. Creating an /infinite/ loop being able to go between them.
I also need to change the topViewController, to my dashboard_VC after the user has logged in. So the back button to the login page doesn't show up...
I've been trying to find a solution for a while. I've mainly been looking at rootViewController, until I realized that's probably not the one I'm looking for since my rootViewController is my navigationController and not my first View Controller in the stack.
So I tried to change the stack with this:
self.navigationController?.setViewControllers([LandingPageVC(),LoginVC()], animated: false) However this causes an infinite loop. Since It runs every time this viewController is loaded, and when it's run, it seems to reload all the viewcontrollers...
I tried putting it in viewDidAppearAnimated instead. But same results. I've since then been trying to put this outside the viewDidLoad or Appear methods. but I can't get it to work since the class doesn't have "navigationController".
Any help would be greatly appreciated!
(I'm not using storyboards)