美文网首页
Carthage的使用

Carthage的使用

作者: 随心随缘不随便 | 来源:发表于2018-01-15 16:49 被阅读4次

安装Carthage有以下几种方法:

  1. brew update -> brew install carthage
  2. 下载安装包:Carthage.pkg
  3. 下载源码:克隆源码 master 分支,并 make install(需Xcode 9.0,Swift4.0)
使用
  1. 在项目根目录下创建一个Cartfile文件

    终端命令:touch Cartfile

  2. 使用Xcode打开Cartfile文件

    终端命令:open -a Xcode Cartfile

  3. 添加所需依赖库

    如:github "AFNetworking/AFNetworking" ~> 3.0
    
        ~> 3.0 :表示使用3.0以上低于4.0的版本
        == 3.0 :表示只使用3.0版本
        >= 3.0 :表示使用3.0或更高的版本
    
  4. 在终端下运行carthage update

    carthage update 会更新支持的所有平台版本
    若需要更新指定平台版本,如:iOS 请使用 carthage update --platform iOS 命令

  5. 导入目录下Carthage目录,在 Target—>Build Setting—>Framework Search Path添加路径 $(SRCROOT)/Carthage/Build/iOS 以自动搜索 Framework

    也可将编译好的 .framework 直接拖入项目中

示例代码

相关文章

网友评论

      本文标题:Carthage的使用

      本文链接:https://www.haomeiwen.com/subject/nqjdoxtx.html