我们先看一看官方给出的导入方法
- Add the ReactiveCocoa repository as a submodule of your application’s repository.
- Run
script/bootstrapfrom within the ReactiveCocoa folder. - Drag and drop
ReactiveCocoa.xcodeprojandCarthage/Checkouts/Result/Result.xcodeprojinto your application’s Xcode project or workspace. - On the “General” tab of your application target’s settings, add
ReactiveCocoa.frameworkandResult.frameworkto the “Embedded Binaries” section. - If your application target does not contain Swift code at all, you should also set the
EMBEDDED_CONTENT_CONTAINS_SWIFTbuild 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.xcodeproj和Carthage/Checkouts/Result/Result.xcodeproj到工程里面

拖拽
添加framework
在target>General里面的Embedded Binaries里面添加ReactiveCocoa.framework和Result.framework

添加framework
设置EMBEDDED_CONTENT_CONTAINS_SWIFT
在target>Build Settings下搜索EMBEDDED_CONTENT_CONTAINS_SWIFT然后设置为"Yes"

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