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
530
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
110
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
280
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
430
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
690
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
610
UICollectionView Compositional Layout
usamik26
0
680
Coding Swift with Visual Studio Code and Docker
usamik26
0
450
Swift Extension for Visual Studio Code
usamik26
2
910
Other Decks in Programming
See All in Programming
Remix on Hono on Cloudflare Workers
yusukebe
1
300
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
C++でシェーダを書く
fadis
6
4.1k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Quine, Polyglot, 良いコード
qnighy
4
650
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
Jakarta EE meets AI
ivargrimstad
0
590
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
Better Code Design in PHP
afilina
PRO
0
130
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
How STYLIGHT went responsive
nonsquared
95
5.2k
What's new in Ruby 2.0
geeforr
343
31k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Facilitating Awesome Meetings
lara
50
6.1k
Side Projects
sachag
452
42k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Fireside Chat
paigeccino
34
3k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Six Lessons from altMBA
skipperchong
27
3.5k
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 ͓͢͢Ί