Integrating GoogleSignIn

Hi guys,

i integrated log in with google to my app and it works.

But there is no transition after logging in successfully via Google.
How can i change my rootViewController after logging in?

What do you have set up in your storyboard as the ViewController you want to transition to when login is successful?

Ok i guess i know what you mean.

if authorization is successful i change the rootViewController to my HomeViewController.

When i understand it correctly these two lines has to be in the HomeViewController, right?

GIDSignIn.sharedInstance()?.presentingViewController = self

I’ll have to read the documentation to understand how Google Sign In works and the options you have once sign in has been successful. At the moment it’s not making any sense to me.

Maybe someone else will chime in with an answer.

I was reading the documentation in the link you provided and how you get to your HomeViewController depends on how you set up your storyboard for your HomeViewController. ie, is it embedded in a Navigation Controller?

I assume that you added the code specified at step 4, ie:

func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!,
          withError error: Error!) {
  if let error = error {
    if (error as NSError).code == GIDSignInErrorCode.hasNoAuthInKeychain.rawValue {
      print("The user has not signed in before or they have since signed out.")
    } else {
  // Perform any operations on signed in user here.


The other complication in the documentation is that it was written prior to the change in Xcode where AppDelegate has now been split into AppDelegate and SceneDelegate. It would appear that it does not take that into account.

Not sure what to advise.