Since the publishing of my article about Facebook login integration, I have received tons of requests that wanted me to cover some other sign-in methods in iOS.

After doing a quick search on Google, I found that most of the blog posts that talk about Google Sign-in integration are quite old and might have been outdated.

Therefore, I think it is good for me to create a step-by-step tutorial on how to integrate Google Sign-in into an iOS app so that anyone who is working on the integration can refer to this article to get a clearer picture.


The Sample App

Throughout this article, I will show you how to configure your Xcode to use the Google Sign-in SDK as well as how to handle UI changes after a user completed the sign-in/sign-out action.

The following animated GIF showcases what we will achieve at the end of this article.

Google Sign-in integration sample app

Google Sign-in integration sample app

With all that being said, let’s buckle up and get right into it!


Google Sign-In SDK Installation

Just like every other integration, we first must install all the required dependencies. For our sample app, we will use CocoaPods to install the Google Sign-in SDK.

Fire up your terminal and navigate to the location of the sample app. Use the following command to generate a Podfile.

After that, open the Podfile created for your sample app and add the following:

pod 'GoogleSignIn'

Here’s how your podfile should look like:

<Podfile to install Google Sign-in SDK

Podfile to install Google Sign-in SDK

Save the Podfile, head back to the terminal and run the following command:

pod install

After the installation is completed, you should see a workspace file (.xcworkspace) has been created for your sample app. Double click the workspace file and launch your sample app in Xcode.

To ensure the SDK installation is successful, open AppDelegate.swift and import the SDK.

#software-engineering #software-development #mobile-app-development #ios-app-development #programming #ios

Google Sign-In Integration in iOS
1.15 GEEK