一、下载安装-两种姿势
1).下载Carthage.pkg
https://github.com/Carthage/Carthage/releases
2).Homebrew安装
1.brew update
2.brew install carthage
二、开始尝试
1.vim Cartfile
目前只支持Github或者Github Enterprise中的repositories.
/******************************************************************************************
Example Cartfile:
# Require version 2.3.1 or later
github "ReactiveCocoa/ReactiveCocoa" >= 2.3.1
# Require version 1.x
github "Mantle/Mantle" ~> 1.0 # (1.0 or later, but less than 2.0)
# Require exactly version 0.4.1
github "jspahrsummers/libextobjc" == 0.4.1
# Use the latest version
github "jspahrsummers/xcconfigs"
# Use the branch
github "jspahrsummers/xcconfigs" "branch"
# Use a project from GitHub Enterprise
github "https://enterprise.local/ghe/desktop/git-error-translations"
# Use a project from any arbitrary server, on the "development" branch
git "https://enterprise.local/desktop/git-error-translations2.git" "development"
# Use a local project
git "file:///directory/to/project" "branch"
******************************************************************************************/
2.carthage update
...clone
...
...Downloading
3.完成后,会在更目录中生成Carthage文件夹以及Carthage.resolved文件,有点类似Cocoapods。
4.添加依赖Framework
在Build Setting中的Framework Search Path中添加:
$(SRCROOT)/Carthage/Build/iOS
或者在General中Embedded Binaries手动添加
其他:
1.在.gitignore添加Carthage文件
#Carthage
Carthage
2.只支持动态库,iOS8以及iOS8以上
3.设置platform
例如:iOS
carthage update --platform iOS