- Add the URL of the framework's repo to your
Cartfile
using one of the following:
github "ReactiveCocoa/ReactiveCocoa" # GitHub.com
github "https://enterprise.local/ghe/desktop/git-error-translations" # GitHub Enterprise
git "https://enterprise.local/desktop/git-error-translations2.git"
git "/Users/user/foo/bar.git"
…optionally followed by one of the following version specifiers:
>= 1.0 for “at least version 1.0”
~> 1.0 for “compatible with version 1.0”
== 1.0 for “exactly version 1.0”
"some-branch-or-tag-or-commit" for a specific Git object (anything allowed by git rev-parse)
-
Run
carthage update
. This will clone and build the framework for you. -
Drag-and-drop the framework into your Xcode project. It should be located here:
../Carthage/Build/iOS/Framework.framework
-
Add the framework in Embedded Binaries, under the target's General settings tab.
-
Add the Carthage build directory to your Framework Search Paths under the target's Build Settings.
$(PROJECT_DIR)/Carthage/Build/iOS
- Add a run script under the project's Build Phases that runs Carthage's copy-frameworks tool.
/usr/local/bin/carthage copy-frameworks
- Make sure you add the path to the built framework as an input file to the run script.
$(SRCROOT)/Carthage/Build/iOS/Framework.framework
- Now, simply use
import Framework
anywhere in your project to use its public interface.
This is quite convenient. Thanks.