Overview

I want to add a JSON Web Token library to my xcode project.

Install Cocoapods


> sudo gem install cocoapods

Fetching: cocoapods-core-1.5.3.gem (100%)
Successfully installed cocoapods-core-1.5.3
Fetching: cocoapods-downloader-1.2.1.gem (100%)
Successfully installed cocoapods-downloader-1.2.1
Fetching: molinillo-0.6.6.gem (100%)
Successfully installed molinillo-0.6.6
Fetching: atomos-0.1.3.gem (100%)
Successfully installed atomos-0.1.3
Fetching: nanaimo-0.2.6.gem (100%)
Successfully installed nanaimo-0.2.6
Fetching: xcodeproj-1.6.0.gem (100%)
Successfully installed xcodeproj-1.6.0
Fetching: cocoapods-1.5.3.gem (100%)
Successfully installed cocoapods-1.5.3
Parsing documentation for cocoapods-core-1.5.3
Installing ri documentation for cocoapods-core-1.5.3
Parsing documentation for cocoapods-downloader-1.2.1
Installing ri documentation for cocoapods-downloader-1.2.1
Parsing documentation for molinillo-0.6.6
Installing ri documentation for molinillo-0.6.6
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for nanaimo-0.2.6
Installing ri documentation for nanaimo-0.2.6
Parsing documentation for xcodeproj-1.6.0
Installing ri documentation for xcodeproj-1.6.0
Parsing documentation for cocoapods-1.5.3
Installing ri documentation for cocoapods-1.5.3
Done installing documentation for cocoapods-core, cocoapods-downloader, molinillo, atomos, nanaimo, xcodeproj, cocoapods after 8 seconds
7 gems installed


Add a Podfile


Create a new Podfile using the following command:

> pod init


This command will create a default Podfile like the following:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'KeystoneSDKDemo' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!


  # Pods for KeystoneSDKDemo
  pod 'JSONWebToken'

end


Edit the Podfile and add you import using the pod 'library' syntax as depicted above.


Run pod install to download and add the pod to your project.

> pod install


You may have to update the repo

> pod repo update



Using a Podfile will require that you use open the code using the workspace instead of the project.

> open KeystoneSDKDemo.xcworkspace


References

ReferenceURL
Cocoapods.orghttps://cocoapods.org/