Created
April 25, 2017 03:32
-
-
Save MarksCode/e20eb0d6e1492cd54f4ae8a84abb341c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In my iPhone app's home screen I need to check whether the user is logged in or not. In my `viewDidAppear()` I check like this: | |
override func viewDidAppear(_ animated: Bool) { | |
if let user = FIRAuth.auth()?.currentUser { | |
// user is logged in | |
} else { | |
// user not logged in, send to home page | |
self.performSegue(withIdentifier: "NotLoggedInSegue", sender: self) | |
} | |
} | |
In every example online I see people using `FIRAuth.auth()?.addStateDidChangeListener` in their code. If my app's only authentication is through gmail, do I need that or is the way I'm checking if the user is logged in fine? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment