How to Hotfix Carthage Dependencies

 · 2 min
Eugen Str on Unsplash

We’ve all been there: One of our dependencies is just a little off for our needs. There might be a decision by the developer we don’t agree with, or we need more configuration possibilities. Or worse, a nasty bug in an unmaintained dependency. What should we do now?

If you open an issue for a bug or a nice addition in functionality, it might be implemented by the author. But what about particular changes for exactly our needs? They might not be aligned with the direction the author is having for the framework. And what if the project is already dead?

Too often, you will find awesome stuff that isn’t updated or supported anymore, but that won’t keep us from using it.

Customizing a framework

Let’s say we have a dependency defined in our Cartfile:

github "awesome-dev123/NoLongerSupportedFramwork" ~> 3.0

Step 1: Fork it

First we need to fork the project on GitHub and clone it, so we can work on it.

Step 2: Do it

Now it’s time for our changes/fixes/additions.

Step 3: Use it

Change the dependency in the Cartfile to your repository:

github "my-github-account/NoLongerSupportedFramwork" "master"

Step 4: Finished

That’s it!

We’re just a carthage update away from using our customized framework. And we get all the advantages of a forked project like the possibility to sync upstream changes, too.

Share your work

Our changes might be useful for others, especially if we’re fixing a bug. So don’t forget to create a pull request, so others can benefit from it, like we did from the framework in the first place.