Skip to content

Instantly share code, notes, and snippets.

@ianbarber
Created March 17, 2015 20:14
Show Gist options
  • Save ianbarber/08c6f56df3f5882ab9ad to your computer and use it in GitHub Desktop.
Save ianbarber/08c6f56df3f5882ab9ad to your computer and use it in GitHub Desktop.
ViewController for GIDSignIn example
class ViewController: UIViewController, GIDSignInDelegate {
@IBOutlet weak var signInButton: GIDSignInButton!
override func viewDidLoad() {
super.viewDidLoad()
GIDSignIn.sharedInstance().delegate = self
// Test to see if we are signed in on load.
GIDSignIn.sharedInstance().signInSilently()
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
if (error == nil) {
signInButton.hidden = true;
println("Signed in!")
} else {
println("\(error.localizedDescription)")
}
}
func signIn(signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!, withError error: NSError!) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment