private-spec-repo

CocoaPods Private Spec Repo

Introduction

platform :ios, '8.0'

target 'MyApp' do
  pod 'AFNetworking', '~> 2.6'
end

The above example Podfile will install AFNetworking from a Public Spec Repo provided by CocoaPods. If we need to use a private library via CocoaPods, we need a Private Spec Repo.

What We Need

  1. Private Spec Repo - a git repository that store a list of private repo

  2. Library Repo - a git/svn repository that store the source code of the library

How we create/update a private pod

Steps

1. Modify source code of the library

2. Commit and push to remote Git repo

3. Add a git tag for a version

4. Update the version number (same as git tag) of the Podspec

5. Validate the Podspec before push

LibraryA - a library may contains dependency of public pods only LibraryB - a library that contains a static library need use-libraries flag LibraryC - a library which contains dependency of other private pods

6. Push the updated Podspec to the private spec repo

You need to add the repo if you're not done before

Push the podspec to the private spec repo for any version update:

7. Done, now can use the pod with the new version in Podfile

Add the private spec repo url at the very first line of the Podfile, the default public spec repo of CocoaPods also need to be added

Local Pod Development

Pods' source code will be pull from remote (git/svn) for normal declaration

if a path is specified, CocoaPods will get the source code from local path instead of remote (git/svn repo)

For well organized the stable pods and development pods, may declared both in separate functions

To choose from different pods, just execute it out side the def block:

Example Podspec

Example Podfile

References

Last updated

Was this helpful?