position: fixed; top: auto !important; margin-left: 112px;

What is Cocoapods?

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
use_frameworks!

pod 'GoogleSignIn'

end

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.

ls

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 .


Previous Next Article







codzify.com


Largest collection of up-to-date tutorials to learn programming languages. We are focused on easy learning. Massive collection of interview questions one may need for preparation.

Social Profile


Linkedin
Twitter
Facebook

Copyright 2018. All rights reserved.