Swift.iOS: CocoaPods – Searching for Pods

In this lesson

Once you are in your Podfile, how do you know where to find the pods that you are looking for. The first place I’d suggest is cocoapods.org! After that, GitHub!

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. I’m going to talk to you about how to find CocoaPods for your project. There are a couple ways to do this. You can either search through CocoaPods.org or on GitHub.com.

00:28

Let’s say that I already have a CocoaPod in mind here, as it says you can search by keyword, summary and dependencies, but let’s just search by name. Alamofire, which I’m pretty sure is the most used, at least, most starred on GitHub Swift repo. We can just click here on expand and see Alamofire was the first result. It shows the documentation from the GitHub page. I think we can actually open it like that and see the same documentation.

01:03

Additionally, on CocoaPods.org, there are some additional analytics and links and info and release information in addition to just the documentation which gives us everything we need to know about it. Up here is the most recent stable version or release of Alamofire, which is what we want to add to our project. You see here, you can hit this copy button, copy everything here and then just add it to the Podfile. Now we have defined the Alamofire CocoaPod in our Podfile for our project SteamReader. Really, this is like the only line in this whole file that’s actually doing anything. To get the same effect, since most everything else is commented out, we can actually have it be the only line in our Podfile. Which is great. There’s our first CocoaPod.

01:58

Let’s say we also have another that we wanted to download and it was AlamofireImage, which was the second search result here. We can just manually edit that or we can scroll to it, copy it. We see that it has a different version number than the one we were additionally working with. We can just override that with a copy and paste.

02:20

Additionally, if you are searching through GitHub, the names that you actually want to use in your Podfile, they typically line up with the actual text you want to use. See Alamofire here and then Alamofire in our Podfile. The version number we can just check out releases to see what’s new. Version 3.4.0, which we have version 3.4 specified. I would recommend just double checking against CocoaPods.org for the exact name and version number that you want to use.

02:56

I’ve never run into a library or repo that has releases being CocoaPods compliant and some not. Even with some of the smaller libraries. So that’s great. Just check on CocoaPods.org even if you have a pod in mind or a library in mind that you want to use that’s on GitHub. It’s most likely going to be in CocoaPods too, if you’re not the very first person to use it.

Additional Info

Register to get access to additional resources and info.