How to install Cocoapods in Xcode?

CocoaPods manages library dependencies for your Xcode projects.The dependencies for your projects are specified in a single text file called a Podfile. you can install and update pod file in your project. The main goal is to install and updated library of third party library without adding or removing the library.
First of all you have to install CocoaPods on OS X, CocoaPods which built in ruby, Using terminal you installed CocoaPods on OS X.

Simple Steps to installed pod file:

1. Open terminal  
2.Command on terminal: sudo gem install cocoapods
3. set your project path on terminal.

4. command : pod init

5. go to pod file of your project and adding pod which you want to install

6 . added in pod file : pod 'AFNetworking', '~> 2.5

7. Command : Pod install

8. Close project of Xcode

9. open your Project from terminals

10. Command : open PodDemos.xcworkspace

Description of Steps :

Open terminal of and write command after you will ask system password, Enter your password in it, it will take too much time to installed CocoaPods, Wait until complete installation. 
$ sudo gem install cocoapods

After successfully installed , display number of gem installed in terminal. Now create file > New > Project >podDemo.
Now again open terminal, Set up path of podDemo on terminal. so write cd  "Your project path". go to project and drag and drop in terminal. See below image.

Now you can get path of your project, then write command "pod init" in terminals. then one pod file generated in your project.
Open this pod file double click on it, Now go to site https://cocoapods.org/, and search which you want to added in your project, suppose I want to install AFNetworking 3.0.4, in search to get AFNetworking 3.0.4.
Now there is installation guide of pod file, Copy  and paste in your project pod file, and save it.
Now again go to terminal, and write command "pod install", then installed third party library inside  project. go inside project it display, there is generated pods folder inside project, see third image.
Close your Xcode project and open project using terminals. write command "open podDemo.xcworkspace".
Now import in your project file and use it.
Thanks,
How to install Cocoapods in Xcode? How to install Cocoapods in Xcode? Reviewed by KIRIT MODI on 23:29:00 Rating: 5

No comments:

Powered by Blogger.