Challenge 18: CocoaPods

I’m still sick and couldn’t manage to do anything yesterday. But now I had some time over and tried to install CocoaPods.

What is CocoaPods?

CocoaPods is a library of pre-made functions so you don’t have to write everything from scratch. Using CocoaPods also means it’s under maintenance and you don’t have to download and manually reinstall every Pod. You just enter in your terminal Pod Install. Also if you have used Composer, NPM, Gems or Bower, you’ll understand CocoaPods.

Prerequisites

You know how to navigate with the terminal and you have xcode installed.

How to do it

  1. Open xcode and create a project. Close Xcode when you are done.
  2. Use the terminal and navigate to the folder of the project you just created.
  3. In the terminal write touch Podfile, this will create the Podfile.
  4. Then write open Podfile, this will open the file so you can edit it.
  5. In the text field, you write the code. For example I used SwiftyJson and here’s how my Podfile looks like.
platform :ios, '8.0'
use_frameworks!

target 'Challenge 18' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end

Then in your terminal, you write Pod install. This can take a while.

When it’s all done, go to your folder and open the new workspace. Mine is called Challenge 18.xcworkspace. Then you can start to edit.

Full project

The person in the video creates in object-c, it doesn’t matter.

Resource