add / Remove CocoaPods in Project

Steps to setup the CocoaPods

Open Terminal

CocoaPods runs on ruby so update your system.

sudo gem update –system

Install CocoaPods

Install CocoaPods by using following command :

sudo gem install cocoapods

If you are facing issue in EL Capitan or macOS Sierra then use following command :

sudo gem install -n /usr/local/bin cocoapods

Setup the Pod

pod setup

Note : This process will take some time.

Steps to add Alamofire and SwiftyJSON Pods to your project

Open Terminal

Navigate to the directory containing your AlamofireSwiftyJSONSample project by using the cd command:

cd ~/Path/To/Folder/Containing/AlamofireSwiftyJSONSample

Give the init command

pod init

It will create Podfile in your project’s directory.

Open the Podfile using command Or Open directly with double click on “Podfile” in project folder

open -a Xcode Podfile

Edit the pod file with your pods which you want to use and must remember the targets. Add pods to the particular target where you want to use that pod.

In Swift you have to add one more line use_frameworks!

So, Your Podfile will look like as :

Below code change “AlamofireSwiftyJSONSample”, “AlamofireSwiftyJSONSampleTests”, “AlamofireSwiftyJSONSampleUITests” To Project name

platform :ios, ‘9.0’

use_frameworks!

target ‘AlamofireSwiftyJSONSample’ do

    pod ‘Alamofire’

    pod ‘SwiftyJSON’

end

target ‘AlamofireSwiftyJSONSampleTests’ do

end

target ‘AlamofireSwiftyJSONSampleUITests’ do

end

Go to terminal and give following command

1

pod install

Note : From now you have to use the .xcworkspace of your project.

Let’s use it in our project

remove CocoaPods from a project?

open terminal

cd /Users/leooverseas/Desktop/CherishGold

sudo gem install cocoapods-deintegrate cocoapods-clean

pod deintegrate

pod clean

rm Podfile

Leave a comment