Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Cocoapods?

What is Cocoapods? I've seen that a lot of developers have been using Pods when developing apps to install APIs, but I'm not grasping why you couldn't just import the files manually. What is their purpose, and how are they helpful?

like image 546
James Avatar asked Mar 07 '14 21:03

James


People also ask

What are CocoaPods used for?

What is it and what does it do? Cocoapods is an application level dependency manager that runs on objective-c, swift, and any other programming languages that run on Objective-C. It focuses on source-based distribution of third party code and allows automatic integration to your Xcode projects.

Is CocoaPods a library?

CocoaPods has over 82,000+ libraries and counting, and is being used in over three million apps. You can choose to create either a public or a private third-party library. A public library can used by others who could then suggest improvements to your code.

Is CocoaPods only for iOS?

Here at Carbon Five, we consider testing the software we write to be crucial to the long term stability and velocity of our projects. We also value developer productivity.

Is CocoaPods like NPM?

Cocoapods is the dependency manager for iOS. Just like npm is for JavaScript (more specifically Node. js) projects.


2 Answers

"CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 30 thousand libraries and is used in over 1.9 million apps. CocoaPods can help you scale your projects elegantly." via http://cocoapods.org

Essentially, it helps you incorporate 3rd party libraries, frameworks, into your product without worrying about how to set them up and configure your project, which at times could be a huge pain.

Regarding why can't you just include files in your project?

  • Since these are 3rd party so you will have to download and copy them to your project every time there is a new version? Lets say, you have 10 libs or frameworks in your project, now imagine the time it will take you to check if anyone of them has any new version that you want to update? and Worst if something does not work, you need to revert back to previous version? It does take time and is a nuisance, with CocoaPods you simply type pod update and updates the ones that have newer versions available.

  • Now If you want v1.1 of one particular library? How easy would it be for you to skim through Git commit history to find out which one you need? With CocoaPods, you simply say pod 'AFrameworkLib', '1.1'

  • Every lib requires setting up your project with a certain set of configuration to make them work, doing it for 10 or so libraries and then fixing conflicts is pain in itself. With CocoaPods, its taken care of automatically.

  • Last but not least, you have to include licenses for all 3rd party libraries you are using to provide credit to original developer of that library. Imagine copying 10 license docs and making sure they are up to date? CocoaPod automatically creates an acknowledgement file in your project that you can simply include somewhere appropriate.

like image 177
Yas Tabasam Avatar answered Oct 13 '22 02:10

Yas Tabasam


From https://cocoapods.org:

CocoaPods manages library dependencies for your Xcode projects.

The dependencies for your projects are specified in a single text file called a Podfile. CocoaPods will resolve dependencies between libraries, fetch the resulting source code, then link it together in an Xcode workspace to build your project.

Ultimately the goal is to improve discoverability of, and engagement in, third party open-source libraries by creating a more centralised ecosystem.

Project link: link

Specs (third-party tools):link

Getting started guide: link

like image 23
Shams Ahmed Avatar answered Oct 13 '22 01:10

Shams Ahmed