美文网首页程序员iOS 开发
怎样导入ReactiveCocoa

怎样导入ReactiveCocoa

作者: CxDtreeg | 来源:发表于2016-01-04 22:11 被阅读2469次

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

    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到工程里面

    拖拽

    添加framework

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

    添加framework

    设置EMBEDDED_CONTENT_CONTAINS_SWIFT

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

    设置EMBEDDED_CONTENT_CONTAINS_SWIFT

    End

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

    相关文章

      网友评论

        本文标题:怎样导入ReactiveCocoa

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