Comment on page
Original Author: Vin Bui
CocoaPods is a dependency manager for Swift and Objective-C projects in Xcode. It is used in over 3 million apps and contains over 95 thousand libraries. It is similar to pip for Python and npm for NodeJS. In other words, you can use code written by other people in your own Xcode project to make your life easier!
- 1.To install CocoaPods, simply run the following in the command line:
sudo gem install cocoapods
- 2.Navigate to your Xcode project directory and run this command:
pod init. This creates a
Podfilein your directory.
- 3.Open the
Podfileand list out the pods you want to install. For example, if I wanted to install the latest version of SnapKit and Alamofire, my
Podfilewould look something like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Pods for MyApp
Change ‘MyApp’ to the name of your project.
- 1.Once you are done, save your
Podfileand install the dependencies by running
- If this command does not work, try
pod install --repo-update
You must open the Xcode workspace instead of the project when using CocoaPods!