我們先看一看官方給出的導(dǎo)入方法
- 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”.
好噪裕,現(xiàn)在我們開始導(dǎo)入...
首先呢,說是要添加這個ReactiveCocoa庫作為當(dāng)前應(yīng)用庫的子模塊召衔。所以得有添加Git才行祭陷。
創(chuàng)建Git
打開終端進入當(dāng)前項目的目錄下依次執(zhí)行下列命令創(chuàng)建git
$ git init
$ git add .
$ git commit -m 'Initial'
添加ReactiveCocoa子模塊
執(zhí)行下面的命令創(chuàng)建子模塊
$ git submodule add https://github.com/ReactiveCocoa/ReactiveCocoa.git ReactiveCocoa
$ git add .gitmodules ReactiveCocoa
$ git commit -m "Add submodule"
運行bootstrap腳本
現(xiàn)在在終端進入ReactiveCocoa/script,運行bootstrap腳本
$ ./bootstrap
拖拽xcodeproj
現(xiàn)在拖拽ReactiveCocoa.xcodeproj
和Carthage/Checkouts/Result/Result.xcodeproj
到工程里面
添加framework
在target
>General
里面的Embedded Binaries
里面添加ReactiveCocoa.framework
和Result.framework
設(shè)置EMBEDDED_CONTENT_CONTAINS_SWIFT
在target
>Build Settings
下搜索EMBEDDED_CONTENT_CONTAINS_SWIFT
然后設(shè)置為"Yes"
End
好了醇蝴,到此為止ReactiveCocoa就成功的導(dǎo)入了想罕,可以愉快的寫代碼了