1. Carthage的安裝與使用
1.1 使用Homebrew安裝Carthage
$ sudo brew install carthage
1.2 查看及升級Carthage版本
$ carthage version
$ brew upgrade carthage
$ brew cleanup carthage
1.3 卸載Carthage
$ brew uninstall carthage
1.4 創(chuàng)建空的Cartfile文件
$ touch Cartfile
1.5 使用Xcode命令打開Cartfile文件
$ open -a Xcode Cartfile
1.6 添加依賴庫
e.g. github "Alamofire/Alamofire" ~> 3.0
1.7 保存并關(guān)閉Cartfile文件并執(zhí)行carthage update
- Cartfile:文件用來標(biāo)注你需要哪些依賴庫扣蜻,對應(yīng)版本或者 Git 分支(需要提交到 Git)队丝。
- Cartfile.resolved:文件用來跟蹤項目當(dāng)前所用的依賴版本號,為了保持多端開發(fā)一致(需要提交到 Git)洁桌。
- Carthage:文件夾用來存放依賴庫的源文件和編譯后的文件(不需要提交到 Git仁期,可以修改.gitignore文件,增加忽略 Carthage 文件夾就行了:#Carthage Carthage)。