Using 3rd-party libraries using CocoaPods

What is Cocoapods?

CocoaPods is the dependency manager for Swift and Objective-C Cocoa projects. It has almost ten thousand libraries and can help you scale your projects elegantly.

Reference: https://cocoapods.org/

CocoaPods

CocoaPods

Open your terminal and type this command:

sudo gem install cocoapods
Installation CocoaPods via terminal.

Installation CocoaPods via terminal.

Init your xcode project.

pod init

Search for pod file in your xcode project (podfile). Then list the dependencies in a text file named Podfile in your Xcode project directory:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
  pod 'AFNetworking', '~> 2.5'
  pod 'ORStackView', '~> 2.0'
  pod 'SwiftyJSON', '~> 2.1'
end

Now you can install the dependencies in your project:

pod install
pod install

pod install

Open your *.xcworkspace.

HelloWorld.xcworkspace

HelloWorld.xcworkspace

You can verify it here to make sure your dependencies already installed.

Pod

Pod

One thought on “Using 3rd-party libraries using CocoaPods

Leave a Reply

Your email address will not be published. Required fields are marked *