in a project, I have a login system. If the login is accepted I put this piece of code to redirect to the first page.
let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.default){ action in
if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "DashboardViewController") as? DashboardViewController{
if let navigator = self.navigationController {
navigator.pushViewController(viewController, animated: true)
}
}
}
myAlert.addAction(okAction);
OperationQueue.main.addOperation {
self.present(myAlert, animated: true, completion: nil)
}
everything works but now on my first page "DashboardViewController" I have added one. tab bar controller.
if I redirect to page 1 the tab bar controller is not taken into account but if I start my project by tab bar controller everything works. so my question is how to redirect to tab bar controller after my login
You can redirect to tabbarController like
let tabBarController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: tabBarControllerIdentifier)
if let navigator = self.navigationController {
navigator.pushViewController(tabBarController, animated: true)
}