Install
CocoaPods is distributed as a ruby gem, installing it is as easy as running the following commands in the terminal:
$ [sudo] gem install cocoapods $ pod setup
Now that you’ve got CocoaPods installed it’s time to get started.
Get started
Search for pods by name and description.
Then list the dependencies in a text file named Podfile in your Xcode project directory:
$ edit Podfile platform :ios pod 'JSONKit', '~> 1.4' pod 'Reachability', '~> 3.0.0'
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project file when building your project:
$ open App.xcworkspace
Now you can import your dependencies e.g.:
#import <Reachability.h>
How to create a pod
Sometimes CocoaPods doesn’t yet have a pod for one of your dependencies. Fortunately, creating a pod is pretty easy:
$ pod spec create Peanut $ edit Peanut.podspec $ pod spec lint Peanut.podspec
When you’re done, please create a ticket and upload the pod. You can also fork theCocoaPods specs GitHub repository and send a pull request. We really love contributions!