最近公開した BBSM 打撃編、実はRxSwiftの勉強用でもあったのでした。
今回は準備までの記事。
cocoapods
RxSwiftのインストールには、 carthage を使うこともできる。 実際、RxSwiftだけならCarthageで十分だし、ライブラリ管理もしやすい。
が… 他にも使いたいFrameworkがある場合は、まだcocoapods に分があるように感じる。
ということで、cocoapods で RxSwift を使います。
1 2 3 4 5 |
brew install cocoapods (以下, RxSwift 4.0対応) pod repo update --verbose pod update |
xcodeでプロジェクト作って、プロジェクトのルートに Podfile を作成。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Uncomment the next line to define a global platform for your project platform :ios, '10.0' target '<ProjectName>' do frameworks use_frameworks! # Pods for <ProjectName> pod 'RxSwift', '~> 4.0' pod 'RxCocoa', '~> 4.0' target '<ProjectName>Tests' do inherit! :search_paths # Pods for testing pod 'RxBlocking', '~> 4.0' pod 'RxTest', '~> 4.0' end target '<ProjectName>UITests' do inherit! :search_paths # Pods for testing pod 'RxBlocking', '~> 4.0' pod 'RxTest', '~> 4.0' end end |
“<ProjectName>” は、適宜修正する。
その後、
1 |
pod install |
して、
コメント