Tab Bar Controller showing on storyboard but not at execution time

582 views Asked by At

My app is working fine and I have the following structure:

enter image description here

The highlighted one is the tab bar controller, which is not displaying at execution time. Everything else is working fine. What seems to be the problem? I want the following workflow:

Auth social login view controller-> Main View Controller with 4 tabs at the bottom. And on the main tab I have a table view controller that has a list of cards that takes to another activity. As I said before this is the current workflow except for the fact that the tab bar controller is not showing at all on the Main View Controller. Any help will be much appreciated.

UPDATE: I dragged from the UI components the tab view controller but still no luck. Navigation still works but no tab bar displayed to reach the 3 other viewControllers. This is my current structure.

enter image description here

1

There are 1 answers

0
John On BEST ANSWER

For the record: I finally solved it by embedding the the Auth login View controller in a navigation controller, and then redirecting not to the main activity but to the tab bar controller and now it works. I achieved this redirection instantiating the tab var controller on the Auth View Controller and using the Auth view controller's navigation controller to redirect to the Tab View Controller....The code:

    func redirectUserToMain(){
        //user is logged in, redirect to main View

        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        let mainTabBarController = storyboard.instantiateViewController(withIdentifier: "MainTabBarController") as! UITabBarController
         self.navigationController?.pushViewController(mainTabBarController, animated: true)
   }

And the final working structure:

enter image description here