In #126, I mentioned CocoaPods. There is a newer alternative tool for 3rd party code dependency management called Carthage.
The developers described it as:
"CocoaPods (by default) automatically creates and updates an Xcode workspace for your application and all dependencies. Carthage builds framework binaries using xcodebuild, but leaves the responsibility of integrating them up to the user. CocoaPods’ approach is easier to use, while Carthage’s is flexible and unintrusive."
There are a few key differences between Carthage and CocoaPods:
- Carthage only supports dynamic frameworks. So the third party code must have targets to build dynamic frameworks. It also means that your project has to support iOS 8 and newer only.
- Carthage doesn't have a centralized ecosystem like CocoaPods, so there is no central repository or list of 3rd party modules/repositories that are supported. You are on your own to find the code that you want and create a target to build a dynamic framework if it doesn't already support that.
- Carthage is less intrusive. You get to use and maintain your own
.xcodeproj
.
Here's how to use it:
-
Install Carthage:
Download and run Carthage.pkg or use homebrew:
brew install carthage
-
Create a Cartfile that lists the frameworks you want to use:
github "ReactiveCocoa/ReactiveCocoa" >= 2.3.1 github "jspahrsummers/libextobjc" == 0.4.1
-
Run:
carthage update
-
Drag and drop the built frameworks in Carthage/Checkouts into your Xcode project.
You then iterate through steps 2-4 during development.
Your feedback is valuable: Do you want more nuggets like this? Yes or No
.
.