I want to customize Google Sign-In button like below:-
I have tried below links, but none of them helped really much:-
How to customize google sign in button?
ht
For Swift 4: (This is working code Enjoy)
@IBAction func logimByGoogle(_ sender: Any) {
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().signIn()
}
//MARK:- Google Delegate
func sign(inWillDispatch signIn: GIDSignIn!, error: Error!) {
}
func sign(_ signIn: GIDSignIn!,
present viewController: UIViewController!) {
self.present(viewController, animated: true, completion: nil)
}
public func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!,
withError error: Error!) {
if (error == nil) {
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
let idToken = user.authentication.idToken // Safe to send to the server
let fullName = user.profile.name
let givenName = user.profile.givenName
let familyName = user.profile.familyName
let email = user.profile.email
// ...
} else {
print("\(error)")
}
}