Development Pods

Many CocoaPods pods work out-of-the box fullfilling your application’s needs. But sometimes, you have to modify them to do something special. CocoaPods makes the process eazier.

So, imaging, your project is linked to SwiftyDropbox. That means, you have something like this in your Podfile:

platform :ios, '9.0'
project 'MyApp.xcodeproj'
use_frameworks!
target 'Application' do
use_frameworks!
# Dropbox
pod 'SwiftyDropbox', '~> 4.1.0'
end

At some point, you decide to modify some file inside SwiftyDropbox. You can navigate to the file under the Pods Xcode project, however when you try to edit it, Xcode would ask you about unlocking.

Default Xcode preferences present this prompt upon editing attempt

Even, when you respond with Unlock, your edits will be lost upon next $ pod update. What you have to do here is install the pod as a Development Pod.

First of all, it is useful to fork the original repo and clone it to your local filesystem. I would recommend to rename the directory, with the fork to be SwiftyDropbox-yourusername highlighting the fact, that this is your fork, not the original repo. Also, the changes, you plan to make, luckily deserve separate branch made from current HEAD.

In order to install the pod from git repo sitting on your disk instead of being hosted on the cloud, the Podfile record has to be modified to:

pod 'SwiftyDropbox', :git => '/Users/yourusername/path/to/repo/SwiftyDropbox-yourusername', :branch => 'mybranch'

But wait! In this way, the dependancy is still installed with locked files status and changes are erased upon next $ pod update.

To specify Development Pod in the Podfile do the following:

pod 'SwiftyDropbox', :path => '/Users/yourusername/path/to/repo/SwiftyDropbox-yourusername'

Notice, :path and absence of :branch.

To install dependency from this repo, open Terminal and run $ cd your/project/directory (note: not the dependency directory) and update just your pod by $ pod update SwiftyDropbox.

Open you project and navigate to Pods project. You have to see the Development Pods group.

You can edit files under this group and changes are reflected in the dependancy local git repo. Try it out!

When you are done, you can commit changes to your fork, push it to GitHub and add the dependency:

pod 'SwiftyDropbox', :git => 'https://github.com/yourusername/SwiftyDropbox.git', :branch => 'mybranch'

Notice remote path and .git extension. This way, your changes are available for all contributors cloning your project.

NOTE: As much as possible, when you see your changes might help other folks around to solve their problems, push them to upstream.

UPDATE: Smart quotes are replaced with “stupid” quotes in all code snippets.