怎样导入ReactiveCocoa

我们先看一看官方给出的导入方法

  1. Add the ReactiveCocoa repository as a submodule of your application’s repository.
  2. Run script/bootstrap from within the ReactiveCocoa folder.
  3. Drag and drop ReactiveCocoa.xcodeproj and Carthage/Checkouts/Result/Result.xcodeproj into your application’s Xcode project or workspace.
  4. On the “General” tab of your application target’s settings, add ReactiveCocoa.framework and Result.framework to the “Embedded Binaries” section.
  5. If your application target does not contain Swift code at all, you should also set the EMBEDDED_CONTENT_CONTAINS_SWIFT build setting to “Yes”.

好,现在我们开始导入...
首先呢,说是要添加这个ReactiveCocoa库作为当前应用库的子模块。所以得有添加Git才行。

创建Git

打开终端进入当前项目的目录下依次执行下列命令创建git

$ git init   
$ git add .   
$ git commit -m 'Initial'

添加ReactiveCocoa子模块

执行下面的命令创建子模块

$ git submodule add https://github.com/ReactiveCocoa/ReactiveCocoa.git ReactiveCocoa   
$ git add .gitmodules ReactiveCocoa
$ git commit -m "Add submodule"

运行bootstrap脚本

现在在终端进入ReactiveCocoa/script,运行bootstrap脚本

$ ./bootstrap

拖拽xcodeproj

现在拖拽ReactiveCocoa.xcodeprojCarthage/Checkouts/Result/Result.xcodeproj到工程里面

怎样导入ReactiveCocoa_第1张图片
拖拽

添加framework

target>General里面的Embedded Binaries里面添加ReactiveCocoa.frameworkResult.framework

怎样导入ReactiveCocoa_第2张图片
添加framework

设置EMBEDDED_CONTENT_CONTAINS_SWIFT

target>Build Settings下搜索EMBEDDED_CONTENT_CONTAINS_SWIFT然后设置为"Yes"

怎样导入ReactiveCocoa_第3张图片
设置EMBEDDED_CONTENT_CONTAINS_SWIFT

End

好了,到此为止ReactiveCocoa就成功的导入了,可以愉快的写代码了

你可能感兴趣的:(怎样导入ReactiveCocoa)