I'm trying to build my first IOS App and trying to implement Firebase Google sign-in following the documentation located here: https://firebase.google.com/docs/auth/ios/google-signin. The issue is trying to change views if a user has successfully signed in. I have tried several solutions regarding this problem from other Stack overflow posts with none seeming to work. I believe this is because of the new sceneDelegate file which the other solutions don't have to take into account as they're using previous versions of XCode.
The Google sign-in is implemented in the App Delegate and the specific code that actually tries to authenticate a user (In the App delegate) is here:
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?) {
// ...
if let error = error {
// ...
return
}
guard let authentication = user.authentication else { return }
let credential = GoogleAuthProvider.credential(withIDToken: authentication.idToken,
accessToken: authentication.accessToken)
Auth.auth().signIn(with: credential) { (authResult, error) in
if let error = error {
// ...
return
}
// User is signed in
// Here i want to change views
}
}
Once the user is signed in how do I change views? I have tried everything I can find and everything seems to not work or crash the app.
Any help is much appreciated