Creating a Cocoapod

Episode #28 | 13 minutes | published on 08/09/2012
Free Video
In this episode, we'll create a CocoaPod out of the modal picker view component we created in episodes 25 & 26. We'll see how to tag & push our code to a github repository and create a podspec so that others can use this component in their projects.


Creating a Podspec

pod spec create

This will create the example MyProject.podspec file that you need to fill out.

Filling out the Podspec File do |s|         = "BSModalPickerView"
  s.version      = "0.1"
  s.summary      = "A custom UIPickerView with a simple list of options, along with a toolbar for Done/Cancel and a faded backdrop view."
  s.homepage     = ""

  s.license      = { :type => 'MIT', :file => 'LICENSE' }       = { "Ben Scheirman" => "" }
  s.source       = { 
    :git => "", 
    :tag => "0.1"

  s.platform     = :ios, '4.0'
  s.source_files = '*.{h,m}'
  s.requires_arc = true

Verifying that the Podspec is Valid

pod spec lint MyProject.podspec

Adding the Podspec to the CocoaPods Specs Repo

  1. Fork the repository at
  2. Add your podspec file to its own versioned folder
  3. Push to your fork
  4. Issue a Pull Request

Pushing Podspecs to Custom Repositories

If you want to publish your podspec to a custom repository, you can follow these instructions on the wiki.

blog comments powered by Disqus