Handling root view controllers in an app

I have an app with a tab bar layout dashboard. The user, when launches the app, opens up to the first tab bar item of the tab bar. However, if the user is not registered, the first launch takes the user to the login sequence where they can register.
Setting the tab bar controller as the "initial view controller" always opens up the app to that.
How can I add the logic in the code to check if the user is logged in (open the tab bar controller) or not (open the login view controller)