下面介绍的是carthage基本使用方式, 具体详细的使用方式请参考Carthage官方教程。
-
Get Carthage by running
brew install carthage
or choose another installation method -
Create a
Cartfile
in the same directory where your .xcodeproj or .xcworkspace is -
List the desired dependencies in the Cartfile, for example:
-
github “Alamofire/Alamofire” ~> 4.7.2 Run carthage update
-
A Cartfile.resolved file and a Carthage directory will appear in the same directory where your .xcodeproj or .xcworkspace is
-
Drag the built .framework binaries from Carthage/Build/
into your application’s Xcode project. -
If you are using Carthage for an application, follow the remaining steps, otherwise stop here.
-
On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:
-
/usr/local/bin/carthage copy-frameworks Add the paths to the frameworks you want to use under “Input Files”. For example:
For an in depth guide, read on from Adding frameworks to an application