Sometimes time spent reinventing the wheel results in a revolutionary new rolling device. But sometimes it just amounts to time spent reinventing the wheel.
— Don’t Make Me Think, Steve Krug (Amazon)
Manually adding third-party libraries to an Xcode project can be a difficult and tedious process. If even one linker flag, build phase, or framework import is off, the process could fail.
Luckily, there’s a tool that makes this process much easier: CocoaPods.
What is CocoaPods?
CocoaPods is a library dependency manager for Mac OS X and iOS that simplifies the process of adding third-party libraries to your project.
Simply add the library you’d like to use to what’s called a
Podfile, run the
pod install command, and everything will be downloaded and configured properly.
Note: This post isn’t meant to be an in-depth tutorial on how to use CocoaPods — if you’d like to read more about the tool, take a look at their fantastic Getting Started guide.
If you read about a pod you’d like to try, run the
pod try PodName command to open up the pod’s demo project.
Great Pods For Every Project
There are currently over 3,400 pods in the master Specs repo with over 1,800 contributors. When starting a new project, sometimes it’s hard to find the right pod for the job.
These pods can help bootstrap your development process.
- CocoaLumberjack - A simple, powerful, and flexible logging framework that enhances the process of debugging.
You can combine this gem with the Xcode colors Xcode plugin to get colored debug output.
MagicalRecord - A library that brings the Active Record pattern to Core Data. MagicalRecord also helps remove the ugly Core Data boilerplate code.
FMDB - An Objective-C wrapper for SQLite. If your app performs large batch updates to Core Data and you’re seeing poor performance, using FMDB can give you finer control and the extra speed boost.
- AFNetworking - One of the most widely-used open source projects for iOS and Mac OS X, AFNetworking helps simplify the process of networking.
With the most recent release of
NSURLSessionin iOS 7, I’ve started moving away from AFNetworking. However, there are still some situations where AFNetworking 2.0 excels. You can read more about that here.
- RNCryptor - An encryption library that wraps the built-in CCCryptor with an easy-to-use syntax. RNCryptor is a simple, secure way to safeguard your sensitive data.
- SSKeychain - A wrapper for the system Keychain in Mac OS X and iOS. SSKeychain is great for storing user credentials.
- FontAwesomeIconFactory - A library that adds support for FontAwesome, an iconic font originally designed for Twitter Bootstrap. This library makes it easy to add high quality icons to your controls.
- Kiwi - A unit-testing library that makes your tests more readable by using an RSpec-inspired syntax.
- SVProgressHUD - A clean and easy-to-use HUD that displays the progress of an ongoing task. I’ve found this HUD to be the most visually-appealing, but there’s also MBProgressHUD.
Using CocoaPods is a great way to add third-party libraries to your project. I’ve saved countless hours by using some of these amazing third-party libraries!
If you’d like to suggest a pod, send me a note via Twitter or email.