CocoaPods, Objective-C’s answer to Ruby Gems

Reading Time: 1

CocoaPods

Do you regularly use opensource code for generic tasks or  cool components that would otherwise consume way too much time of your project?
Then I’m sure that you envy the Ruby (on Rails) community that has those Gems and the Bundler mechanism that enables you to get a specific version of an component and integrate it in your project automagically.

Guess what? It is already here for your iOS/ MacOS based project (and has been for quite some time)!

The name of the beast is CocoaPods and it is quite a charming monster.

CocoaPods has an online repo, so check it out at  Cocoapods.org where more and more opensource projects get each week and search for the stuff that you’d like to integrate. Then all you need to do is add a so-called “Podfile” to your project that defines what version of the components / libraries that you want to include. When you’ve setup the file and added the dependancies just run

and you’re good to go. This also saves you the need to include all the opensource projects into your SCM and keeps it clean and tidy!

if this is going a little too fast for you, check out this sweet tutorial from Ray Wendelich’s website to get a step-by-step introduction.

For those people that don’t like switching to the Terminal back and forth; there even is this XCode 5 plugin that enables you to install the Pods with the push of a button.