- 安裝carthage:brew install carthage
- 查看版本: carthage version
- 創建Cartfile文件:touch Cartfile
- 編輯Cartfile文件:
//版本4.4以上,5.0以下
github "Alamofire/Alamofire" ~> 4.8.0
//版本4.8.0以上
github "Alamofire/Alamofire" >= 4.8.0
//指定版本 4.8.0
github "Alamofire/Alamofire" >= 4.8.0
//最新版本
github "Alamofire/Alamofire"
//指定 Git branch
github "Alamofire/Alamofire" "branch"
//其他 Git倉庫
git "https://gitee.com/Alamofire/Alamofire.git"
//本地倉庫
git "file:///desktop/project"
- 更新:
//全部更新 --platform iOS 只編譯iOS平臺
carthage update --platform iOS
//更新某個庫
carthage update Alamofire/Alamofire --platform iOS
//指定多個(逗號隔開)
carthage update Alamofire,SwiftyJSON --platform iOS
//如果有其它用戶要使用你的project,如果你沒有在code中提交已構建好的framework
carthage bootstrap
- 使用
將Build\iOS
文件下的framework,拖動到Linked Frameworks and Libraries
中
在Build Phases
中,添加一個新的Run Script:
/usr/local/bin/carthage copy-frameworks
在Input Files
中,爲每個framework添加一個entry:
$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework