Redirect after login to a tab bar controller

tab bar controller after login
pass data between tab bar view controllers swift 4
uitabbarcontroller change view controller programmatically
how to add a tab bar to an existing view controller
tab bar controller swift
uitabbarcontroller select tab programmatically
push view controller tab bar
tab bar not showing swift

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)


                    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)

Swift: how to show a tab bar controller after a login view, To show tab bar controller from Login page, connect the Login page and TabbarController with a Show segue and give it an identifier in attributes inspector (Say "mySegueIdentifier"). To add segue, just right click and drag from Login view controller to TabbarController. And if it’s time to show the tab bar controller, then put the tab bar controller as the root. Run the app, and click the sign in button. Success! That’s it, you got the idea, now you can implement a sign out button by yourself to redirect your users back to the login screen 🙂

let tabBarVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "TabBarVC") as! TabBarVC
    tabBarVC.selectedIndex = //your selected tab index
    navigationController?.pushViewController(tabBarVC, animated: true)

Dont redirect dashboardVC go with tabbarVC and then select tabIndex that you want your first page

Swift Login / Logout Navigation Process - Paul Allies, Here I show a “login” view controller when user is not logged in otherwise show After creating the Login and Tab Bar VCs, we need to add a  Re: WLC webauth redirect URL after login I have a custom web page and i have put the url redirect on the controller under security-> web fine when i test it with a windows machine but with the blackberry and iphone i get the captive portalput in the login. it doesn't do the url redirect..wondering if this is nornal?

I handled it slightly differently.

 func transitionToHome() {

    let tabBarViewController = UIStoryboard(name: Constants.Storyboard.mainStoryBoard, bundle: nil).instantiateViewController(withIdentifier: Constants.Storyboard.tabBarController) as! UITabBarController

      view.window?.rootViewController = tabBarViewController


I am reassigning the tabBarController to be the root view so that the user can return without having to log in again. I also use a constant file to keep my constants organized for complex projects. You can see how I reference them in the code above.

struct Constants {

struct Storyboard {

    static let homeViewController = "HomeVC"

    static let tabBarController = "HomeTVC"

    static let mainStoryBoard = "Main"


Swift: how to show a tab bar controller after a login view, Swift: how to show a tab bar controller after a login view - ios. database i tasks di */ /* Redirect al tab HOME dell'applicazione dove si mostrano  some.web/foo/bar/7; that can call a common utility controller like. locale/change/es or authorization/login. How do I get these methods (change, login) to redirect to the previous actions (details, info, bar) while passing the previous parameters to them (5, bob, 7)?

Present a login screen before the tab bar controller in a , Present a login screen before the tab bar controller in a Now run the app, you should see the Login screen after the app launch. can implement a sign out button by yourself to redirect your users back to the login screen. Redirect to a Controller Action The last piece of the puzzle is that you can redirect to a specific Method of a specific Controller, no matter what its Route or URL is – use method action (): return redirect ()->action ('App\Http\Controllers\BooksController@index');

How to transition from login screen to tab bar controller, Instead of presenting the tab bar controller on top of login view controller: present After setting the storyboard identifier, head over to  A. automatically redirect the user to a visual force page right after login Or B. display a modal dialog box on the home tab like the salesforce "Getting started with Chatter " It would be possible? any other options/suggestion are welcomed Thanks in advance. csbaa

Open app in specific view when push notification is tapped, Say you have an app and want to redirect user to a specific view chat room in Telegram after tapping push notification of that message. Notice that UIWindow is on the furthest back in the hierachy, the tab bar controller is stacked on Afraid that you might not be able to implement Sign in with Apple in  Hello, I have two roles in my web application: Admin and User. I have a controller to manage users, but only Admin role is authorized to see it, so I have decorated the controller with Autorize att

  • Currently how are you redirecting to tabBarController ?
  • yes, in fact I want to always redirect to the first page but that the tabbar is taken into account
  • have you tried with tabBarVC.selectedIndex = // your selected index at the time of redirection to tabbarController?
  • Are you instantiate tab bar controller by identifier after you added it to storyboard? (this line - if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "DashboardViewController") as? DashboardViewController)
  • no, i saw another topic that speaks about tabBarVC but i do not know how to redirect
  • use of undeclared type tabBarVc I must add something?
  • yes you have to add your identifier like, TabBarVC instead of DashboardViewController
  • can I send you a link with the project and you show me an example?
  • i can not share project for example but if u have face any problem surely give solution have you any problem in my answer?