title: Change tab bar in swift programmatically
body: <p>I am trying to change tab bar in  didFinishLaunchingWithOptions method programmatically, but it won't work, any idea?</p>
  
  <p>I have tried: </p>
  
  <pre><code>    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {
  
      if let tabBarController = self.window!.rootViewController as? UITabBarController {
                  tabBarController.selectedIndex = 0
              }
  return true
  }
  
  </code></pre>
  
  <p>Thanks,</p>