我们先看一看官方给出的导入方法
- Add the ReactiveCocoa repository as a submodule of your application’s repository.
- Run
script/bootstrap
from within the ReactiveCocoa folder. - Drag and drop
ReactiveCocoa.xcodeproj
andCarthage/Checkouts/Result/Result.xcodeproj
into your application’s Xcode project or workspace. - On the “General” tab of your application target’s settings, add
ReactiveCocoa.framework
andResult.framework
to the “Embedded Binaries” section. - 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.xcodeproj
和Carthage/Checkouts/Result/Result.xcodeproj
到工程里面
添加framework
在target
>General
里面的Embedded Binaries
里面添加ReactiveCocoa.framework
和Result.framework
设置EMBEDDED_CONTENT_CONTAINS_SWIFT
在target
>Build Settings
下搜索EMBEDDED_CONTENT_CONTAINS_SWIFT
然后设置为"Yes"
End
好了,到此为止ReactiveCocoa就成功的导入了,可以愉快的写代码了
网友评论