All Articles

How to install Cocoapods in your iOS project

If you’re a beginner, you probably have wondered how to set up Cocoapods in your iOS project. Cocoapods is a dependency manager for Swift & Objective-C, and has over 24,000 libraries to spice up your application. It’s incredibly helpful to integrate code that has already been written to maximize your time working.

How to install a Cocoapod in your project

  1. After creating your Xcode project, open a new Terminal window
  2. Go into the directory your project is in (example: YourName/Projects/MyApp/). You may have to use multiple cd (change directory) commands to get into it through Terminal
  3. When you’re in the directory, type touch Podfile which will create your podfile
  4. Type open Podfile to open it – it should open in a text editor
  5. You will have a blank document. To add your Cocoapods, write the following code and replace the highlighted text:
target 'MyApp' do
pod 'AFNetworking', '~> 3.0'
pod 'FBSDKCoreKit', '~> 4.9'
  1. Save the document, go back to Terminal and type pod install. Your dependencies should have installed if there were no errors (read the log to be sure)
  2. Instead of opening the .xcodeproj, open the .xcworkspacefile instead – keep on using the .xcworkspace file moving forward

Read more:

Using CocoaPods: