Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift 2.0でRxSwift、ReactKit、ReactiveCocoaを使ってみた
Search
Shinichiro Oba
October 14, 2015
Programming
10
5k
Swift 2.0でRxSwift、ReactKit、ReactiveCocoaを使ってみた
potatotips #22で発表した資料の加筆修正版です。
http://connpass.com/event/20240/
Shinichiro Oba
October 14, 2015
Tweet
Share
More Decks by Shinichiro Oba
See All by Shinichiro Oba
サーバサイドエンジニアと効率よく開発するためにやっていること
bricklife
8
2.2k
アッテ開発の技術:Swift と RxSwift
bricklife
19
17k
RxSwiftのobserveOnとsubscribeOnを理解する
bricklife
20
7.5k
ReactiveCocoaのゆるい紹介とメルカリでの活用事例
bricklife
3
3.8k
Apple Pay対応のやりかた
bricklife
1
25k
iOS版グローバル対応の罠と技
bricklife
8
24k
Other Decks in Programming
See All in Programming
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
110
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
390
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
930
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
1
330
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
120
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
410
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.4k
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
110
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
130
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
180
ゲームの物理 剛体編
fadis
0
370
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
47
Embracing the Ebb and Flow
colly
88
4.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
The SEO Collaboration Effect
kristinabergwall1
0
300
A designer walks into a library…
pauljervisheath
210
24k
Balancing Empowerment & Direction
lara
5
810
Technical Leadership for Architectural Decision Making
baasie
0
180
KATA
mclloyd
PRO
33
15k
How Software Deployment tools have changed in the past 20 years
geshan
0
29k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.7k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
260
Transcript
Swift 2.0で RxSwift、ReactKit、 ReactiveCocoaを使ってみた 株式会社メルカリ iOSエンジニア ⼤庭慎⼀郎
⾃⼰紹介 ⼤庭 慎⼀郎 (ooba / bricklife) 株式会社メルカリ 2013年4⽉⼊社 「メルカリ」iOS版を開発
メルカリとは? いわゆる「フリマアプリ」 2013年7⽉ JP版リリース 2014年8⽉ US版リリース
Swift 2.0で リアクティブプログラミング
選択肢 RxSwift ReactKit ReactiveCocoa etc..
RxSwift ReactiveXによる正統派Rx RxCocoaと⼀緒に提供されている Swift 2.0対応版は2.0。現時点でプレリリース版のみ https://github.com/ReactiveX/RxSwift/tree/ 2.0.0-alpha.4
ReactKit LINEの稲⾒さん作。Swift初期からある 同じ作者のSwiftTaskと合わせて使う Swift 2.0対応版が正式リリースされている https://github.com/ReactKit/ReactKit
ReactiveCocoa Objective-C時代からある⽼舗 Swift 2.0対応版は4.0。現時点でプレリリース版のみ https://github.com/ReactiveCocoa/ ReactiveCocoa/tree/v4.0-alpha.1
公式なドキュメントと サンプル
RxSwift ドキュメント、サンプル ともにリポジトリの中に 含まれる。結構豊富
ReactKit ドキュメントは最低限。 サンプルは専⽤のリポジ トリがあって結構豊富 https://github.com/ ReactKit/ ReactKitCatalog
ReactiveCocoa ドキュメントは多めだが、サンプルはなし 現状README.mdのコードもコンパイル通らない… つらい…
実際に使ってみた
やってみたこと データバインディング(プロパティ⇔UI) APIアクセスのストリーム化 インクリメンタルサーチ
データバインディング
Swiftでのプロパティ更新監視 純粋なSwiftのクラスではKVOができなくなった リアクティブプログラミングのライブラリでは各⾃で 更新監視できる仕組みを⽤意している ※ NSObjectのサブクラスでdynamicなプロパティな らKVOが動く
RxSwift KVOの代わりにVariableを使う
ReactKit KVOに依存
ReactiveCocoa KVOの代わりにMutablePropertyを使う
古き良きReactiveCocoa プロパティの変更をテキストフィールドに⾃動反映 テキストフィールドの変更をプロパティに⾃動反映 RAC(self.accountNumberTextField, text) = RACObserve(self.viewModel, accountNumber); RAC(self, inputText)
= textField.rac_textSignal;
APIアクセスのストリーム化 with APIKit
RxSwift
ReactKit
ReactiveCocoa
インクリメンタルサーチ
RxSwift
ReactKit
ReactiveCocoa
他にも試したいこと プロミス デリゲートメソッドコールのストリーム化 通知のストリーム化 MVVM etc..
どれを使えばいいか どれも⻑所短所があって選ぶの難しい 機能や安定性、学習コストを考えると現時点では RxSwiftか? データバインディングはSwiftBondなどを使う選択肢 もあり
組んでみたコード 整理してGitHubで公開予定 公開次第、資料アップデートします
ありがとうございました メルカリ新規事業でメンバー⼤募集中! https://www.wantedly.com/projects/29699 Swift 2.0+iOS 8以上で開発したい⼈ ご連絡お待ちしております