Tutorial details

The magic of CocoaPods | App Code for Sale | Preview

The magic of CocoaPods | iOS Tutorial

Cocoa Pods is an Objective C library manager that manages library dependencies for your Xcode project

Overview PAGE TOP

Hmm… among all tutorials that I have written this one seems that will be most helpful for you.

Yes, remember when we tried to add AFNetworking to our project or core plot…. It was a procedure of certain steps. Now, with Cocoa Pods is one and only step!

Cocoa Pods came to make our life easier.

Cocoa Pods is an Objective C library manager that manages library dependencies for your Xcode project. The goals are:

Make working with dependencies simple. Improve library discoverability and engagement by providing an ecosystem that facilitates this So using Libraries would be just a game.

Let’s start with Pods now.

Install Command Line Tools for XCode PAGE TOP

Xcode includes a “Downloads” preference pane to install optional components. Open this pane by clicking the “Xcode” button in the top left of the screen, then click “Preferences”, then click “Downloads”. Choose Components Tab and click the install button of the Command Line Tools.

Open your terminal and type:

sudo gem update --system

then type:

sudo gem install cocoapods

the type:

pod setup

That’s it!

Create a text file named Podfile PAGE TOP

Now, go to your Xcode project directory and create a text file named Podfile. A Podfile is the file that lists the dependencies of your application, which is usually located in the root of your project.

Navigate to the folder using the appropriate commands on your terminal and then type:

touch Podfile
open -e Podfile

If everything is ok, TextEdit will open to an empty text file. Type inside TextEdit for example:

platform :ios
pod 'JSONKit',
pod 'AFNetworking', '1.0'

With this Podfile you will add to your project JSONKit (the most recent version) and AFNetworking version 1.0. At the beginning you define your platform (you can define osx as well). More about Podfiles you can find here.

Let’s get back to our example. Save and Close TextEdit. In your terminal type:

pod install

If the procedure ended without error we are ready. Open your project folder and you will discover a new file. This is .xcworkspace

This is the workspace where CocoaPods stores all the libraries dependencies. From now on, you will use only this workspace.

That’s it. If you need an additional library just add the appropriate line to your Podfile (use the CocoaPods site to find all the available pods), save it and type in your terminal:

pod install

For a more detailed guide, please read Marcelo’s Fabri great tutorial “Introduction to CocoaPods“


0 Comments Leave a comment

Please login in order to leave a comment.

Newest first

to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.