title: Keep User Logged In in swift
body: <p>I developed app where I open firstly UIViewController with login system, here in viewDidLoad I chech if user loggined in (with firebase) like that</p>
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      view.backgroundColor = .systemBackground
  
      if Auth.auth().currentUser == nil{
          let tap = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard))
          view.addGestureRecognizer(tap)
              
          view.addSubview(logoImageView)
          logoImageView.center = CGPoint(x: horizontalCenter, y: verticalCenter/2.5)
              
          view.addSubview(emailTextField)
          emailTextField.center = CGPoint(x: horizontalCenter, y: verticalCenter)
              
          view.addSubview(passwordTextField)
          passwordTextField.center = CGPoint(x: horizontalCenter, y: verticalCenter+50)
              
          view.addSubview(loginButton)
          loginButton.center = CGPoint(x: horizontalCenter, y: verticalCenter+100)
              
          view.addSubview(dontHaveAccountButton)
          dontHaveAccountButton.center = CGPoint(x: horizontalCenter, y: verticalCenter*1.8)
              
          view.addSubview(showPasswordButton)
          showPasswordButton.center = CGPoint(x: horizontalCenter+100, y: verticalCenter+50)
      }
      else {
          view.addSubview(LlogindButton)
          LlogindButton.center = CGPoint(x: horizontalCenter, y: verticalCenter+100)
      }
  }
  </code></pre>
  <p>My config funk looks like:</p>
  <pre><code>@objc func config(){
      let tabBarVC = UITabBarController()
      
      let vc1 = UINavigationController(rootViewController: feedViewController())
      let vc2 = LibraryViewController()
      let vc3 = UINavigationController(rootViewController: CreatorViewController())
      let vc4 = ProfileViewController()
      let vc5 = UINavigationController(rootViewController: SettingsViewController())
      
      vc1.title = &quot;Feed&quot;
      vc2.title = &quot;Library&quot;
      vc3.title = &quot;Creator Studio&quot;
      vc4.title = &quot;Profile&quot;
      vc5.title = &quot;Settings&quot;
      
      tabBarVC.setViewControllers([vc1, vc2, vc3, vc4, vc5], animated: false)
      
      guard let items = tabBarVC.tabBar.items else{
          return
      }
      
      let images = [&quot;house&quot;, &quot;book.fill&quot;, &quot;paintpalette.fill&quot;, &quot;person.circle&quot;, &quot;gear&quot;]
      
      for x in 0..&lt;items.count{
          items[x].image = UIImage(systemName:  images[x])
      }
      
      tabBarVC.modalPresentationStyle = .fullScreen
      present(tabBarVC, animated: true)
  }
  </code></pre>
  <p>So, here is my problem. In config function I am showing  <code>UITabBarController()</code> and if user logged in I want to show one of my bars from <code>UITabBarController</code> instead of button that call my config func. The same logic provided in instagram and I need something like that.</p>