How do I use Cocoapods in iOS Swift?

2 min 45 sec read

Author: Manish Methani

CocoaPods is used for installing or updating third-party SDKs while working with XCode. Suppose you want to integrate Google Sign-in in your app, then you have to install google SDK. CocoaPods provides an easy way to install the third party SDK like Google Sign-In SDK. Similarly, you can install any third party library with the help of CocoaPods.

How to install CocoaPods?

You can install CocoaPods tool on OSX by running the following command in terminal

sudo gem install cocoapods

How to use Cocoapods to install any third party SDK in iOS App?

In this example, we will add Google SDK in iOS app,

1) Create an Xcode project, and Click Save. We saved the project on Desktop.

2) Create a file named Podfile in your project. This file includes all the dependencies which you want to install.

(File > New > File > Scroll Down to Others Category > Empty > Next > Save As > Podfile > Create)


3) Now open Podfile and add your dependencies.

platform :ios, '9.0'

target 'CodzifyProject' do

pod 'GoogleSignIn'


CodzifyProject is the name of my project. You must replace it it with yours. pod 'GoogleSignIn' is the Google Sign-in SDk which I took as an example to install.

4) Save the file.

5) Open a terminal and cd to the directory containing the Podfile. In my case, project is saved on Desktop.

cd Desktop
cd CodzifyProject
// Here 
CodzifyProject is the name of my sample app.

Now CodzifyProject is the directory which contains Podfile. You can check using ls command.


6) Run pod install command to install the dependencies.

7) Close Xcode. Close terminal. Now you can see .workspace file of your project along with .xproject file on Desktop where your application is created. In our case, its CodzifyProject.workspace. Open it and from now onwards you can use this .workspace file when you start working on it.

In this way you can install any third party SDK using CocoaPods. Just integrate the name of dependency in Podfile and perform the given steps. You can use this link for more information on Google Developers page .

How was the tutorial? Nice. Right?

Deep Concept videos to crack the highly-piad interviews.

Chekout out our Youtube Channel to get detailed video content on important topics in interviews.

What is your Interview Score?

Test your skillset with the curated questions created by experts around the globe.

Book a free test slot. Now !.

It usually takes 30 mins for an online test and this test will be MCQ based. Get detailed analytics based on your test and recommedations with personalised roadmaps.

Book a test slot. Now!

Have questions about the trial coding class?

Chat with our experts to discuss

Connect on WhatsApp

Recommended tutorials

#online compiler for c     #python for programming    

#dfs and bfs algorithm     #programming with c language

#storageclass in C    #listcomprehension in python