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
Yusuke Hosonuma
May 31, 2016
0
180
RxSwift勉強会
Yusuke Hosonuma
May 31, 2016
Tweet
Share
More Decks by Yusuke Hosonuma
See All by Yusuke Hosonuma
KotlinTest で始める Property-based Testing/kotlintest-property-based-testing
yusukehosonuma
2
1.4k
Marzipan の正体は何だったのか そして SwiftUI の衝撃/wwdc19_marzipan_swiftui
yusukehosonuma
2
840
標準パッケージにおけるテストでの利用例から学ぶ testing / quick パッケージ/golang-testing-quick
yusukehosonuma
4
11k
Swift で ParameterizedTest をやってみた話/swift-parameterized-test
yusukehosonuma
4
2k
Property-based test beginning with SwiftCheck
yusukehosonuma
1
5.4k
XCTest(再)入門/reintroduction-to-xctest
yusukehosonuma
0
400
ソースコードから読み解く - Quick はどのように実装されているのか?/quick-code-reading
yusukehosonuma
7
11k
Swift 4.2 はどのような進化をしているのか/whats-new-swift42
yusukehosonuma
16
14k
HTTPモックライブラリ「Mockingjay」を使ってみた話/swift-mockingjay
yusukehosonuma
5
3.7k
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Cult of Friendly URLs
andyhume
78
6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Teambox: Starting and Learning
jrom
133
8.8k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Building Applications with DynamoDB
mza
90
6.1k
A Philosophy of Restraint
colly
203
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Building Your Own Lightsaber
phodgson
103
6.1k
Typedesign – Prime Four
hannesfritz
40
2.4k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Transcript
RxSwiftษڧձ ͦͷ0
ࣗݾհ • Yusuke Hosonuma • ݴޠJavaɺObjective-CɺSwiftɺଞ৭ʑ • ʢ࠷ۙͷʣ࠲ӈͷɿ ͝จ10ؒอकՄೳͳίʔυͰ͔͢ʁ •
QiitaͰ1,000͑ͨΑʂ
RxSwift ʢ͋ʔΔ͍͑ͬ͘͢͢;ͱʣ
͊͞RxSwiftॻͧ͘ʂ
None
ʁ
None
ʂʁ
None
ͦΜͳ͜ͱʹ ͳΒͳ͍Α͏ʹ
·ͣ
ϦΞΫςΟϒ ϓϩάϥϛϯάͷ
ߟ͑ํ͔Βֶ΅͏ʂ
ࠓͷຊ
ϦΞΫςΟϒϓϩάϥ ϛϯάͱԿ͔ʁ
ඇಉظσʔλετϦʔϜ Λ༻͍Δϓϩάϥϛϯά
ඇಉظσʔλετϦʔϜͷྫ • I/OΠϕϯτ • ΫϦοΫΠϕϯτ • λονΠϕϯτ • etc…
͑ɺͦΕͷ Ͳ͕͜৽͍͠ͷʁ
ϦΞΫςΟϒϓϩάϥ ϛϯάͰ
ຆͲͯ͢Λ ετϦʔϜͰߟ͑Δ
ԿͰετϦʔϜ • ม • Ϣʔβೖྗ • ϓϩύςΟ • σʔλߏ •
etc…
ͱ͜ΖͰ ετϦʔϜͬͯԿʁ
ҰݴͰ͍͏ͳΒ
Կ͔͕ྲྀΕͯ͘Δ ʮʯ
౧͕ྲྀΕͯ͘ΔσʔλετϦʔϜʢʣ
ετϦʔϜ ͍ΖΜͳૢ࡞͕ग़དྷΔ
ετϦʔϜͷૢ࡞ • ࡞ ⾣ ৽ͨͳΛ࡞ΕΔ • ߹ʢmergeʣ ⾣ Λ߹ྲྀͯ͠Ұͭʹ͢Δ͜ͱ͕ग़དྷΔ •
มʢfilterɺmapɺflatMapʣ ⾣ ແࢹͨ͠Γɺ౧ଠʹม͑ͨΓʢڧҾʁʣ
ετϦʔϜͷ ՄೳੑΛߟ͑Δ
ͦͷલʹ RxSwiftʹ͍ͭͯগ͠
ུྺ • ReactiveX (Rx) ϑΝϛϦʔͷҰһ • Rxࣗମ.NETൃʢ࣮ރΕٕͨज़ʣ • ڝ߹ʮReactiveCocoaʯʮSwiftBondʯͱ͔
ֶͿϞνϕʔγϣϯ • ঢ়ଶมΛݮΒͤΔ • ෳࡶͳॲཧΛγϯϓϧʹهड़Ͱ͖Δ • ॲཧΛએݴతʹهड़Ͱ͖Δ ʢؔܕͷӨڹڧ͘ड͚ͯΔʣ • ͏ͪͷϓϩδΣΫτͰਖ਼ࣜ࠾༻ʢϐϯνͩΑʂʣ
ؓٳ
ετϦʔϜ
࣌ؒॱʹฒΜͩ ਐߦதͷΠϕϯτͷྻ
None
ҎԼͷ3छྨ͕ྲྀΕͯ͘Δ • ʢԿΒ͔ͷܕʣ • Τϥʔ • ྃ • ʹ͔͠ڵຯͳ͍ͱ͖ɺ Լ2ͭແࢹ͢Δ͜ͱ
͜ͷʢʹʣ ྲྀΕͯ͘ΔͷΛ
ࢹʢlistenʣ͢Δ
ϦΞΫςΟϒ༻ޠͩͱ subscribingʢߪಡʣ
·͊ͭ·Γ
Ͱચ୕͠ͳ͕Β ౧ΛͬͯΔ͓͋ͪΌΜ
μϒϧΫϦοΫͷ ετϦʔϜʹ͍ͭͯߟ͑Δ
ී௨ʹ࣮͢Δͱʁ
μϒϧΫϦοΫͷ࣮ • ΫϦοΫͨ͠λΠϛϯάΛ͓֮͑ͯ͘ม • ִ࣌ؒؒΛௐΔ • τϦϓϧΫϦοΫݕ͠ͳ͍Α͏ʹ • ؆୯ʹͰ͖ͦ͏͚ͩͲΘΓͱ໘ͦ͏
ετϦʔϜͰߟ͑Δͱʁ
250msͷִ͕ؒແ͍࣌ؒͰ ΠϕϯτΛ·ͱΊΔ
Πϕϯτͷ·ͱ·ΓΛ ݸʹม͢Δ
ݸ͕2ͷ͚ͭͩΛ ϑΟϧλʔ͢Δ
ΫϦοΫͷ ετϦʔϜ͔Β
μϒϧΫϦοΫͷ ετϦʔϜ͕ग़དྷͨʂʁ
ετϦʔϜͷՄೳੑ͕ ݟ͖͑ͯ·ͤΜ͔ʁ
͕͖ͳͷϦΞΫςΟϒϓϩάϥϛϯά͚ͩ͞ʂ ໋ྩܗϓϩάϥϛϯάͳΜͯΫιήʔͩʂ
ͦΖͦΖऴΘΓͰ͕͢
͜Ε͔ΒͷཱྀͷಓඪΛ
ಓඪ • ʲ༁ʳ͋ͳ͕ͨٻΊ͍ͯͨϦΞΫςΟϒϓϩά ϥϛϯάೖ http://ninjinkun.hatenablog.com/entry/introrxja • RxSwift: ReactiveX for Swift
https://github.com/tid-kijyun/RxSwift/blob/ translates-into-japanese/README-ja.md • ໎͍ͬͨ࣌ͭͰʮʯΛࢥ͍ग़͢͜ͱ
ͪͳΈʹ෦తʹ
Observerύλʔϯ͕ ΘΕ͍ͯ·͢
͘͜͠ײ͡Δ༻ޠ ͦͷ͋ͨΓ͔Βདྷ͍ͯ·͢
Observer༻ޠ • Subject • Observable • Observer • Subscribe
·ͱΊ
ࠓͷ·ͱΊ • ϦΞΫςΟϒϓϩάϥϛϯάʮඇಉظσʔλ ετϦʔϜʯΛ༻͍Δϓϩάϥϛϯά • ετϦʔϜԿ͔ΒͰ࡞ΕΔɻ • ετϦʔϜ͍ΖΜͳૢ࡞ʢ߹ɾϑΟϧλɾม ʣ͕Ͱ͖Δɻ •
ͯ͢ετϦʔϜͰ͋Δɻ
Thanks.