Carthage 常用命令

  • 安装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 --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

方法二:

在项目中引入依赖的 Framkework,只需要在对应 Target 中的 Build Setting 中的 Framework Search Path 项加入以下路径,Xcode 便会自动搜索目录下的 Framework

$(SRCROOT)/Carthage/Build/iOS

    

你可能感兴趣的:(Swift)