In #126 and #127, I mentioned CocoaPods's a third way, which is to vendor the code directly using Git Submodules (or a similar feature in other version control systems). Like Carthage, it is less intrusive and requires more work than using Cocoapods, but most third party code should work with this approach, and there are a few other benefits:
- you can easily step into and debug the 3rd party code you are vendoring.
- you can apply your own fixes – hopefully before submitting them upstream to the maintainer.
- you can use the latest upstream version even if it hasn't been released as a (Cocoa)pod.
- depending on how the 3rd party code is structured, you may be able to pick and choose the parts that you need.
Here's how to use it, assuming your project is already managed by Git:
Create a vendor/ directory.
Add the 3rd party code as a submodule:
git submodule add https://github.com/AFNetworking/AFNetworking.git vendor/AFNetworking
Drag the folders/files that you need into your Xcode project.
Commit your changes to your Xcode project as well as the submodule.
Make changes to the submodule or run
git pull origin masterto get upstream updates.
You then iterate through steps 2-5 during development.
An important note to working with 3rd party code is not to drop it directly into your Git repository and checking them in. This will make it hard to keep up with changes from upstream.