Timering

Purp

CocoaPods install & first steps - for beginners

CocoaPods is a very effective manager for your Xcode projects. It works perfectly with Objective-C and Swift too. With CocoaPods, you can use more third party open-source libraries. You don't need to copy static libraries, you just need to write 1-2 line code in your terminal, and everything will be work fine.CocoaPods is a very useful manager for your Xcode projects. It works perfectly with Objective-C and Swift too. With CocoaPods, you can use more third party open-source libraries. You don't need to copy static libraries, you just need to write 1-2 line code in your terminal, and everything will be work fine. There are some steps to create your first Podfile.

Steps:

  1. Install CocoaPods
  2. Create Podfile
  3. Install Pod
  4. Use Workspace

Video:

1. Install CocoaPods

First of all, you need to install Cocoapods. Open your Terminal, and write this code:
"$ sudo gem install cocoapods"
Enter your password.

Your result looks like this:

CocoaPods Install Coreplot CocoaPod install result

2. create Podfile

Before your Podfile your Xcode project library looks like similar this:

CocoaPods Install Coreplot Before Podfiles

In your terminal with this code, you can create a Podfile: "$ pod init "

Now you have a Podfile in your library.

CocoaPods Install Coreplot Library Podfile

Just open this file with your TexMate or other similar program, and copy this code into it. (Your file has already contained the text, you just need to add the CorePlot line).

Now, we will use CorePlot pod, which is one of the best graph framework. More about it.

3.Install Podfile

After you have created your Podfile, you need to install it. Navigate into your Project folder and use this code in your Terminal: "$ pod install".

In your terminal you can see these lines: 

CocoaPods Install Coreplot Terminal lines

Now, if everything is fine, your library looks like this:


CocoaPods Install Coreplot All Podfiles

4. Use Workspace

In the future you need to work in your "MyApp.xcworkspace" file and not in your "MyApp.xcodeproj" file. This is very important.  

Open it, and check the Pods Framework and the whole Project library:

Pod file opened Workspace

Pod file opened Workspace

If you want to use CorePlot in your project, just import it: #import "CorePlot.h"

That's all.