Swift.iOS: CocoaPods – Creating a Podfile

In this lesson

When using CocoaPods for the first time in an Xcode project, it is necessary to create your Podfile. Watch for a few ways to do that as well as my recommendation on most efficient way to do that.

Kyle Roberts
Swift Guru at Large

Kyle's Series

Transcript

Tap on time to skip ahead

00:10

Hello world. Kyle here with Brax.tv. We’re on the CocoaPods.org site and we’re going to talk about how you can create a Podfile when using CocoaPods so you can define your Pods and keep working.

00:27

This tip here is basically where it all is. How to create your Podfile. All you need to do is navigate to the directory of your project. We see here the Xcode project right here. If you already have CocoaPods installed or if you’re already using workspace then you’re also going to see workspace here, then you just need to run pod init. I actually have CocoaPods set up on this project already and it’s going to tell you that.

01:03

To get to this point to be able to run pod init, in this project that I’ve already set up CocoaPods in, I’ve just had to delete a few of the CocoaPods files. Pretty much everything except the Podfile from the project directory in Finder.

01:21

pod init. Hooray! It created us a Podfile. I want to open this in Xcode. It created a template for a nice Podfile. I have opened this in Xcode for editing. What’s great about using pod init is that it sets it up so that you can install Pods for each target. In fact, these two test targets are nested so anything you add to the top target, SteamReader in this case, is going to be also added to these two test targets. If you add a Pod to these two test targets then only those test targets will have that Pod. We have our Podfile, fill it out how you want it. Fill it out how you need. Then you’re on your way to installing them using CocoaPods.

Additional Info

Register to get access to additional resources and info.