Programmatically change tabBar item?
<p>I would like to change a <code>TabBar Item</code>, when a User is logged in or not.</p>

<p><strong>For example:</strong> i have 5 different tabBar items, all created an Storyboard.</p>

<p>Now i want to change the tarBar with index 2 (or tag == 2) when i user has no account. I would like to load a different rootViewController. The rootViewController is not already an item of my TabBar, i would load a totally different Controller.</p>

<p>What is the best way to do this? I can simple change the icon with:</p>

<pre><code>self.tabBar.items![0].selectedImage = UIImage(named: "icon_cal_grey")
</code></pre>

<p>But how to i change the rootViewController? </p>

<p>Should i do it here?</p>

<pre><code>override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {

    if item.tag == 1 {
        // ?
    }

}
</code></pre>

<p>Or should ill create a UINavigationController as RootViewController, and load here the "correct" ViewController as RootViewController? </p>