Using CocoaPods in Xcode on your Mac

Mk
1 min readDec 10, 2018

--

First install CocoaPods viasudo gem install cocoapods

Create a file named Podfile and save this file to the same folder your project is located.

The Podfile content should look something like this:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '14.0'
use_frameworks!
target 'NAMEOFYOURAPP' do
pod 'Alamofire', '4.4'
pod 'FBSDKCoreKit', '~> 4.9'
end

The target ‘NAMEOFYOURAPP’ is the name of your Xcode project.

The pods ‘Alamofire’ and ‘FBSDKCoreKit’ are the names of the pod you want to use.

You may specify the pod’s version

pod 'Alamofire', '4.4'

or add a restriction saying that you want the version to be greater than a given one as follows:

pod 'FBSDKCoreKit', '~> 4.9'

Save and close the Podfile.

run pod install and watch the magic unfold.

Anytime you need to update the pod simply navigate to the project folder containing the Podfile and run pod update in terminal (make sure you are in the proper folder).

Important point:

Once you start using CocoaPods you will need to always open and work with .xcworkspace instead of .xcodeproj.

--

--

Mk
Mk

Responses (1)