I'm implementing a user authentication system for an app. If the user is logged in they get one set of available tabs to select. If They're not logged in they get another. Now the issue I'm running into is that after a user logs in (app redirects to safari to some oauth stuff and then returns to the app), I update the tabs from the UITabBarController like so:
private var accessibleViewControllers = [UIViewController]()
func setUpView() {
var viewControllersToSet = [UIViewController]()
if let user = theUser {
for controller in accessibleViewControllers {
if !(controller is LogInViewController) {
viewControllersToSet.append(controller)
}
}
} else {
for controller in accessibleViewControllers {
if controller is LogInViewController || controller is HomeNavigator {
viewControllersToSet.append(controller)
}
}
}
setViewControllers(viewControllersToSet, animated: false)
}
Now the funny thing is, the tab icons don't refresh, but I can still click on the spaces where the new icons would be to link through to the associated view. How do I refresh the tabs so that the right icons appear?