Swift.iOS: CocoaPods – What is CocoaPods?

In this lesson

Today, May 10, 2016, CocoaPods has released version 1.0.0 after many years of development! I have been using CocoaPods on and off for a few years and have been loving it. This series will be about the basics, tips, and cool things you can do with CocoaPods. Enjoy!

Kyle Roberts
Swift Guru at Large

Kyle's Series

Transcript

Tap on time to skip ahead

00:11

What is CocoaPods? Well, if we go to their website, cocoapods.org, there’s a nice little description and a big header asking the same question. “CocoaPods,” as it says, “is a dependency manager for Swift and Objective-C Cocoa projects.” So, Xcode, iOS development.

00:30

This is just one of a few options for managing packages and third party libraries and frameworks and that sort of stuff in projects. As far as I have experienced, this one is the most popular. It’s pretty easy to use. It’s traditionally used in the command line, in terminal. Though, they do have an app that you can download the beta of, at the moment. It seems to me like it may be released pretty soon. They are on the 1.0 release candidate 1. Which is pretty cool. But for now we’ll be going through how to use it in the command line.

01:15

The gist of CocoaPods is that when you run it, it will add a Pods project to your app’s workspace. In that, is a Pod file, which looks like this, it uses this sort of syntax. There’s not file extension here. But you add this Podfile, you fill it out or type everything in and you add the different third party resources you’d like to add. In this case, I’m using these. You can specify the version. Then you do some command line work and it will download them all and link them to your project.

01:56

Within the actual code, you can see we’re importing MagicalRecord here in the AppDelegate, which is one of the pods that we’re actually downloading right here. Then, we have it to use in our code and we don’t have to worry about if MagicalRecord updates, we can see that in CocoaPods when we’re installing the pods. It’s pretty cool and it’s fairly simple. I hope you enjoy learning how to use it.

Additional Info

Register to get access to additional resources and info.