Editing Your Podspec

In this lesson

When editing your new Awesome.podspec, it’s not always immediately obvious what value type a podspec is expecting. In the SteamReader GitHub, I have added a couple podspec templates to the repo for just your reference. SteamReader.podspec I have filled out as if I were going to upload the SteamReader app to CocoaPods. The other, SteamReaderExample.podspec I have populated every podspec setting with a dummy value for examples of values you can use so you have a sense of what is available, what is required, and what you need for your resource!

Kyle Roberts
Swift Guru at Large

Kyle's Series

Transcript

Tap on time to skip ahead

00:11

Hello world, Kyle here and in this video we’re going to be talking about this SteamReaderExample.podspec that I have as a part of the SteamReader GitHub repo. So this podspec as opposed to the other one I have included in SteamReader is more of a general reference to the podspec than the SteamReader one. The other is a smaller podspec that I filled out as if I were creating a podspec for this actual SteamReader project. And this one is more of a template or reference to use. And as of June 2016, the recording of this video, I have included as far as I know everything you can configure when working with a podspec.

00:55

And these are broken into a few sections but you can also reference in the CocoaPods podspec documentation. And those sections are library, platform, build settings, and files. The library section is where you will be storing the general information of your CocoaPod which includes stuff like the name, version, and the actual GitHub URL to your project.

01:22

The platform section is just a way, pretty self explanatory, to define the platform that you are targeting with your library. And of course I have filled out all of these values with real world examples that you may actually use in your own podspec.

01:37

Build settings is a way to define different building and installing configurations when a user will install your podspec. And this is just for a way to make sure that CocoaPods can handle everything and the user has to do nothing but run a pod install. And this includes stuff like setting additional CocoaPods dependencies, referencing any frameworks or libraries that you may be using as well as actually setting any build settings within Xcode to what may be required to run your library.

02:11

And the file section is just a way to navigate and to find files that are included with your resource. For example, setiting public and private header files, other resources that you might be referencing, and any files that you might want to exclude from the upload and install of your pod. This final section here, called subspec, is actually out of the scope of his video so we can just ignore everything below it for now.

02:38

So if you intend to use this SteamReaderExample.podspec as a reference for your own podspec, here are just a few things I’d like you to know to be able to navigate and decipher what I’ve done here. By breaking it into these sections I’ve hoped to make it easy to read and have populated each property with a possible real world example of the acceptable value. Values that are required when creating your podspec I have prefaced with a required comment directly above that. So if we actually search for pound required, we can see that all of the required podspec line items are within this library section at the beginning. Another thing to watch out for when referencing this podspec is that line items that are specifically targeting iOS actually have ability to assign that value to a specific platform or as a blanket statement for all platforms. And a few of these other line items I’ve just included some additional comments for information that may be useful.

03:43

For example, if you ever need to specify the resource or resources paths for your pod, depending on how many paths you actually need to reference you may be able to use just as the resource property and pass in one path or you may need to use the resources property and pass in a set or an array of paths.

04:07

But I hope this example podspec can at least help a few people. If anything you can just copy this entire file into your own personal podspec and start populating it according to your app, deleting any non required items that you may not need.

Additional Info

Register to get access to additional resources and info.