Reputation: 28545
On tapping on a tab I want to navigate to either a LoginViewController or ProfileViewController depending on whether the user is logged in or not.
How can I achieve this in swift , where do i place the logic for this?
At the momen the tab press just navigates to the login screen, but if they are logged in i dont want them to go to the login screen, id rather it just went straight to the profile screen
Upvotes: 1
Views: 89
Reputation: 2832
If I understood correctly what you have and what you want to do this is what i propose to you.
Add willAppear
function to the profileview and there check if there is a user logged in with a value that you would save with userdefaults
and depends of what you will have you will navigate to the view that you have to go.
Upvotes: 1