Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift 2.0でRxSwift、ReactKit、ReactiveCocoaを使ってみた
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
rack-attack gemによるリクエスト制限の失敗と学び
pndcat
0
260
CSC307 Lecture 03
javiergs
PRO
1
480
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
270
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
190
CSC307 Lecture 04
javiergs
PRO
0
650
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
120
AgentCoreとHuman in the Loop
har1101
5
200
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
360
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.3k
Python札幌 LT資料
t3tra
7
1.1k
CSC307 Lecture 02
javiergs
PRO
1
770
2026年 エンジニアリング自己学習法
yumechi
0
110
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
48
Abbi's Birthday
coloredviolet
1
4.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
It's Worth the Effort
3n
188
29k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
130
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Are puppies a ranking factor?
jonoalderson
1
2.6k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
190
Product Roadmaps are Hard
iamctodd
PRO
55
12k
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以上で開発したい⼈ ご連絡お待ちしております