What is a Podspec?

In this lesson

Never looked at a podspec before? Well here is a little tour of what’s involved and what you can do to get associated with it to start one for your own library!

Kyle Roberts
Swift Guru at Large

Kyle's Series


Tap on time to skip ahead


Kyle here with brax.tv and let’s talk about what is a podspec. And of course, we’re working with CocoaPods here. And the first thing we’ll need when talking about podspec is the podspec. Now there are couple ways you can obtain a podspec to work with. Of course you can just create a new podspec from scratch but this is the future and we don’t want to do anything from scratch. You can create a podspec as part of a larger set of work using the pod lib create command and that’s going to set up a whole bunch of library project files for you to work with. But if you only need the podspec you can use the command pod spec create. And you actually need the name there, pod spec create Brax.


Let’s just call it Brax for example, so it says specification created and Brax.podspec in the current directory that we were in, and that’s just an example directory I have my desktop here. And it creates Brax.podspec and now there’s no associated app to open this file type so I’m just going open it in Xcode real quick.


So here’s this template podspec with a bunch of comments with stuff we can follow along with. This is a mix of the required and most common information that you can use in a podspec and it is formatted to work with those. So some of the non comment lines in this podspec are Pod::Spec.new which actually creates this new podspec object in Ruby code. And below we can start setting some of the properties of the podspec including the spec.name which is Brax,  setting the version to 0.0.1, summary to a short description of Brax, homepage, screenshots, license, and on and on as this is just the template podspec that it creates for us.


And of course you can fill them out with all of your own information. But actually in the SteamReader files, not within the actual Xcode project, but in the files I do have to example podspecs for us to look at. One is the SteamReader.podspec. And the SteamReader.podspec is a valid podspec that I have created and populated with information that I would use if I were to upload SteamReader as my own personal CocoaPod on CocoaPods.org. Now since this app SteamReader is more of an example app for videos, I’m not actually going to be uploading it to CocoaPods.org but I would hope that seeing the actual information here in conjunction with its Xcode project. And you may have noticed another SteamReader podspec in Finder, that will be additional information covered elsewhere. 

Additional Info

Register to get access to additional resources and info.