I've successfully set up my app flow logic and everything seems to be working fine except the login. I would like to keep the users logged in so when the app is reopened the profile screen is the first to show. Right now I have code..
override func viewDidAppear(animated: Bool) {
var currentUser = PFUser.currentUser()
println(currentUser.objectId as String)
if currentUser != nil {
self.performSegueWithIdentifier("loginsuccess", sender: nil)
} else {
// Show the signup or login screen
}
}
It works but it seems to be too slow and the login screen flashes for a quick second. Ive searched for a cleaner way to do this but haven't found much.
In this kind of flow I usually play with the rootViewController of window. e.g
Then When Login Successful or Logout, you can switch between the Either Controllers. By calling these method with appdelegate reference.