Search code examples
swiftuinavigationcontrolleruitabbarcontroller

Navigation through TabbarController And NavigationController. How?


i have storyboard file like this:enter image description here

when user is loggedin i make segue with:

 let storyboard = UIStoryboard(name: "Main", bundle: nil)
 let initialVC: UITabBarController = storyboard.instantiateViewController(withIdentifier: "loggedin") as! UITabBarController
 self.present(initialVC, animated: true, completion: nil)

and automaticly open viewcontroller with identifier "selectsaloon", but sometimes depending on the condition I need to go to viewcontroller with identifier "searchparams". help me find a solution


Solution

  • You can Make navigation on viewdidload for selectsaloon when condition occuer

        if (condition) {
      let storyboard = UIStoryboard(name: "Main", bundle: nil)
         let initialVC: UIVieWController = storyboard.instantiateViewController(withIdentifier: "searchparams") as! UIViewController
         self.navigationController.push(initialVC, animated: true)
     }