Skip to content

Instantly share code, notes, and snippets.

@damianesteban
Forked from pxlshpr/Carthage Instructions.md
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damianesteban/01686c7ac25d13b302bb to your computer and use it in GitHub Desktop.
Save damianesteban/01686c7ac25d13b302bb to your computer and use it in GitHub Desktop.
These are the steps required to add and embed a framework into your project using Carthage.
  1. 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)  
  1. Run carthage update. This will clone and build the framework for you.

  2. Drag-and-drop the framework into your Xcode project. It should be located here:

  ../Carthage/Build/iOS/Framework.framework
  1. Add the framework in Embedded Binaries, under the target's General settings tab. Screenshot

  2. Add the Carthage build directory to your Framework Search Paths under the target's Build Settings.

  $(PROJECT_DIR)Carthage/Build/iOS

Screenshot

  1. Add a run script under the project's Build Phases that runs Carthage's copy-frameworks tool.
  /usr/local/bin/carthage copy-frameworks

Screenshot

  1. Make sure you add the path to the built framework as an input file to the run script.
  $(SRCROOT)/Carthage/Build/iOS/Framework.framework

Screenshot

  1. Now, simply use import Framework anywhere in your project to use its public interface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment