How/why podify an external dependency ?

November 4, 2014

So you may use externals pods and you may have packaged your internal libraries as pods. But how do you handle a Vendor.framework ?

It will look like a lot of hassle compared to just drag'n'dropping into Xcode's Project Navigator. But if you use a lot of external dependencies and they are update often, it will save you a lot of time when incompatibilities (or simply the need to iterate through versions of many libs) arise.

It may look dead simple, and that's because ... it is. But as lazy as we are, we can easily think that updating manually is so fast/simple that the podification is not profitable enough.

xkcd said it better:

[caption id="attachment241" align="aligncenter" width="571"]<a href="https://wearemobiledevelopers.files.wordpress.com/2014/11/isitworththetime.png"><img class="wp-image-241 size-full" src="https://wearemobiledevelopers.files.wordpress.com/2014/11/isitworththetime.png" alt="isitworththetime" width="571" height="464" /> xckd : http://xkcd.com/1205/[/caption]

1. Create a pod.
Really simple. Just drop the whole content of the vendor's stuffs into a git repo, push it somewhere it can be fetched.
2. Create a podspec.
Nearly as simple as step 1. The only tricky part is to be sure to keep all the needed files.  Thus inside your "Pod::Spec.new do |s|", It will save you some time to have a look at
  • s.resources
  • s.preservepaths
  • s.vendoredframeworks
  • s.vendoredlibraries
3. Update your podfile
That's all. Really. And now, you can update wholeheartedly because you will be able to revert.