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
580
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
140
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
300
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
450
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
710
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
640
UICollectionView Compositional Layout
usamik26
0
720
Coding Swift with Visual Studio Code and Docker
usamik26
0
480
Swift Extension for Visual Studio Code
usamik26
2
970
Other Decks in Programming
See All in Programming
Formの複雑さに立ち向かう
bmthd
1
720
Lottieアニメーションをカスタマイズしてみた
tahia910
0
120
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
370
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
110
SpringBoot3.4の構造化ログ #kanjava
irof
2
970
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
41
15k
Immutable ActiveRecord
megane42
0
130
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.1k
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
220
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
240
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
270
Featured
See All Featured
Statistics for Hackers
jakevdp
797
220k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Adopting Sorbet at Scale
ufuk
74
9.2k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
We Have a Design System, Now What?
morganepeng
51
7.4k
Documentation Writing (for coders)
carmenintech
67
4.6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
540
Unsuck your backbone
ammeep
669
57k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
240
4 Signs Your Business is Dying
shpigford
182
22k
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 ͓͢͢Ί