Skip to content

Instantly share code, notes, and snippets.

@kgleong
Last active December 31, 2018 06:55
Show Gist options
  • Select an option

  • Save kgleong/183d64eff4677255e7eeea9f6efc8b68 to your computer and use it in GitHub Desktop.

Select an option

Save kgleong/183d64eff4677255e7eeea9f6efc8b68 to your computer and use it in GitHub Desktop.
Google Sign In - View Controller - Configure GIDSignIn singleton
import GoogleSignIn
class ViewController: UIViewController {
// ...
override func viewDidLoad() {
super.viewDidLoad()
/***** Configure Google Sign In *****/
GIDSignIn.sharedInstance()?.delegate = self
// GIDSignIn.sharedInstance()?.signIn() will throw an exception if not set.
GIDSignIn.sharedInstance()?.uiDelegate = self
// Attempt to renew a previously authenticated session without forcing the
// user to go through the OAuth authentication flow.
// Will notify GIDSignInDelegate of results via sign(_:didSignInFor:withError:)
GIDSignIn.sharedInstance()?.signInSilently()
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment