0

I already did LogIn Page and Sign up Page that works fine but it doesn't redirect the user to LogIn Page. At first user will need to log in to be redirected to Profile Page and if the user email or password is wrong the App won't allow the user to continue and also i need help with Logging out user.

Check my flow of navigation here Please help

I'm coding with Swift laters version

Janmenjaya
  • 4,149
  • 1
  • 23
  • 43
alex
  • 17
  • 1
  • 7
  • Your flow in storyboard shows, the tab bar controller is the root controller, then present the login controller modally from tabbar. If you want to show the Login bar at the start up then make Login controller as your root controller – Janmenjaya Sep 02 '16 at 22:30
  • Check my previous answer, it quite close to what you want. http://stackoverflow.com/questions/39159444/how-to-get-navigation-based-template-functionality-in-swift-programming/39159793#39159793 – Bista Sep 03 '16 at 05:15

1 Answers1

0

Let's you have from your back-end server, there is some kind of method that check if someone is currently logged in. It returned either true or false.

Now in your mobile app, you would call that method in didFinishLaunchingWithOptions in the appDelegate to check if you have a user

var currentUser = User() 
//let's say that User class is where you established connection to your server.

if currentUser.isThereAnyUserLoggedIn(){
  // since this statement is true; then just show them your tabBar
 // give the tabBar an ID then initiate it from the storyboard  
} else {
     // which means there is no one
   // then show the loginViewController 
}

Now for the logout method

if currentUser.hasPressedLogoutButton() {
   // show the loginViewController 
 }
Lamour
  • 3,002
  • 2
  • 16
  • 28