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
RxSwift
Search
USAMI Kosuke
August 26, 2015
Programming
0
130
RxSwift
http://kanmoba.connpass.com/event/18762/
USAMI Kosuke
August 26, 2015
Tweet
Share
More Decks by USAMI Kosuke
See All by USAMI Kosuke
Onsager代数とその周辺 / Onsager algebra tsudoi
usamik26
0
630
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
180
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
330
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
480
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
740
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
670
UICollectionView Compositional Layout
usamik26
0
780
Coding Swift with Visual Studio Code and Docker
usamik26
0
510
Swift Extension for Visual Studio Code
usamik26
2
1k
Other Decks in Programming
See All in Programming
KotlinConf 2025 現地参加の土産話
n_takehata
0
100
Benchmark
sysong
0
220
カクヨムAndroidアプリのリブート
numeroanddev
0
430
Spring gRPC で始める gRPC 入門 / Introduction to gRPC with Spring gRPC
mackey0225
2
520
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
320
Create a website using Spatial Web
akkeylab
0
290
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
190
すべてのコンテキストを、 ユーザー価値に変える
applism118
1
360
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
210
Julia という言語について (FP in Julia « SIDE: F ») for 関数型まつり2025
antimon2
3
970
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
280
GoのWebAssembly活用パターン紹介
syumai
3
10k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
42
7.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Bash Introduction
62gerente
614
210k
Navigating Team Friction
lara
187
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Into the Great Unknown - MozCon
thekraken
39
1.9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Transcript
RxSwift
About me 4 Ӊࠤݟ ެี (@usamik26) 4 ϑΣϯϦϧגࣜձࣾ 4 iOS
ΞϓϦΤϯδχΞ 4 0x29ࡀʹͳΓ·ͨ͠
Reactive Programming
Reactive Programming 4 ΠϕϯτͷؔੑʢσʔλϑϩʔʣΛهड़ 4 ͦͷهड़ͰɺҰํͷมԽΛଞํʹ 4 ϝοηʔδૹ৴͕Ӆṭ͞ΕΔ 4 σʔλόΠϯσΟϯά
Reactive ͳΈͱ͍͑Δ
Functional Reactive Programming 4 ඇಉظσʔλετϦʔϜ 4 ࣌ؒ࣠ʹԊ͕ͬͯྲྀΕΔϦετ 4 ετϦʔϜʹର͢ΔϦετૢ࡞ 4
map filter ͱ͍ͬͨؔܕͷΠσΟΦϜ
RP / FRP ͷར 4 Πϕϯτۦಈॲཧ͕ॻ͖͍͢ 4 ඇಉظॲཧ͕ॻ͖͍͢ 4 GUI
ϓϩάϥϛϯάͱ૬ੑ͕ྑ͍
Reactive Programming for iOS
Reactive Programming for iOS 4 ReactiveCocoa 4 ReactKit 4 RxSwift
4 ͻͱͪ͘ʹ Reactive ͱ͍ͬͯߟ͑ํ͕ͪΐͬͱͣͭҧ ͏ 4 ͦΕͧΕʹྑ͕͋͞Δ
RxSwift
RxSwift ͷಛ 4 ReactiveX ϑΝϛϦʔ 4 ࠷ۙਖ਼ࣜʹՃΘͬͨ 4 Swift ωΠςΟϒ
4 ίΞʢRxSwiftʣ Swift ͷΈ 4 Ұ෦ʢRxCocoaʣ Objective-C ΛؚΉ
ReactiveX 4 http://reactivex.io 4 ֤ݴޠ൛͕͋Δ 4 Rx.NET (C#) 4 RxJava
4 RxJS 4 RxSwift 4 ɾɾɾͳͲ 4 Learn once, apply anywhere
RxSwift ͷಋೖ 4 Dynamic Library ͱͯ͠ಋೖʢiOS 8 Ҏ߱ʣ 4 CocoaPods
4 Carthage 4 ϓϩδΣΫτʹΈࠐΈʢiOS 7 ରԠʣ 4 CocoaSeeds
RxSwift / RxCocoa 4 RxSwift 4 Observable / ֤छ Operator
/ Scheduler ͳͲ 4 RxCocoa 4 UIKit / NSURLSession / KVO ͳͲ
Examples
Examples 4 ҎԼΛݟΔͱΑ͍ 4 README 4 RxExample ϓϩδΣΫτ
Examples 1 combineLatest(firstNameLabel.rx_text, lastNameLabel.rx_text) { $0 + " " +
$1 } >- map { "Greeting \($0)" } >- subscribeNext { greeting in greetingLabel.text = greeting }
Examples 2 let userRequest: Observable<User> = API.getUser("me") let friendsRequest: Observable<[Friend]>
= API.getFriends("me") zip(userRequest, friendsRequest) { user, friends in return (user, friends) } >- observeOn(MainScheduler.sharedInstance) >- subscribeNext { (user, friends) in // bind to UI }
Examples 3 searchTextField.rx_text >- throttle(0.5, MainScheduler.sharedInstance) >- distinctUntilChanged() >- map
{ query in API.getSearchResults(query) >- retry(3) >- startWith([]) >- catchError([]) } >- switchLatest >- map { results in // bind to UI }
Documents 4 ReactiveX ຊՈ͕͔Γ͍͢ 4 http://reactivex.io 4 RxSwift 4 Documentation/API.md
ͳͲ
RxSwift 2.0
RxSwift 2.0 4 ݱࡏ։ൃதʢGit ϒϥϯν rxswift-2.0ʣ 4 Swift 2 ରԠ
4 ԋࢉࢠ͕ >- ͔Β . ʹมߋ 4 ෦ϩδοΫ : RxResult ͔Β try - catch ʹ
RxSwift ͓͢͢Ί