Hi Guys

In today’s world, people don’t want to do any manual work they want to do smart work and at the same time they don’t want store there data on the physical drive, the world is so much involved to use the technology to store their data in the cloud by which people can access their data whenever and wherever they want. Its also requires some time to implement the functionality to store their data on google drive through the iOS app. To access the user’s google drive we have to link their Gmail account with the iOS app. Here are the steps that you should follow to implement the google drive in iOS with swift.

Step:1=> Add following pods into your pod file 

=> Open the terminal and migrate to Xcode project

=> If you don’t have a podfile into your Xcode project the run “pod init” command

=> Now run the command “open podfile” and then add the following pods into your podfile.

=> After this,  save your pod file and run the command “pod install”.

Steps:2=> Enable the Google sign in functionality to the AppDelegate class.

To enable sign in, you must configure the shared GoogleSignIn instance to your app. Implement this instance wherever you can, but according to me, we should register it at a time of opening the app. Add the following code in App Delegate class.

Step3=> Implement the Google Sign before using the drive.

=> Import GoogleSignIn in your controller.

In above code sign method is a delegate which ensures that the user has signed with there Gmail account or not. If not then it shows the Gmail default popup to sign in from your Gmail account first with the app.

Step4=> To store the app data on google drive , first we make a custom file which contain our data that we will upload on the drive. Before sending the content to drive we first save the data to the file in the JSON  format. So when retrieving we can parse it easily.

After successfully saving the data on the file you are almost ready to upload the content on the drive.

Steps5=> Instead of writing all the code on the same class I make a seperate class which explained all the method for google drive , By that we can use it easily and it make a code more readable. Class Contain the search , upload file ,delete and download method respectively.

Steps6=> Now you are on the coast to complete this task. Last Step?

Hurray, You have successfully implemented the Google Drive to your app. If you have any queries, then please ask in the comment. 

Thank you, Good Day ?