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
15 minutes recipe of RxSwift
Search
gomi_ningen
April 14, 2016
Programming
0
18
15 minutes recipe of RxSwift
2016/04/14 - RxSwift 勉強会 #1@Sansan
https://sansan.connpass.com/event/27933/
gomi_ningen
April 14, 2016
Tweet
Share
More Decks by gomi_ningen
See All by gomi_ningen
RxSwiftのObservableとは何か | iOSDC Japan 2017
53ningen
0
14
Xamarin.iOS によるプロダクトアプリ開発の実践
53ningen
0
10
この実装には問題がある!
53ningen
0
1.1k
Dependency Injection in Swift2
53ningen
0
23
RxSwiftを用いたアプリ開発の実践
53ningen
0
26
ITSを用いた旅行の構築
53ningen
0
10
Other Decks in Programming
See All in Programming
開発効率向上のためのリファクタリングの一歩目の選択肢 ~コード分割~ / JJUG CCC 2024 Fall
ryounasso
0
430
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
510
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
3
2.3k
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
180
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
2.5k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
EventSourcingの理想と現実
wenas
6
2.2k
現場で役立つモデリング 超入門
masuda220
PRO
15
3.1k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Tauriでネイティブアプリを作りたい
tsucchinoko
0
350
Quine, Polyglot, 良いコード
qnighy
4
630
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
540
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
What's new in Ruby 2.0
geeforr
343
31k
Optimizing for Happiness
mojombo
376
69k
Thoughts on Productivity
jonyablonski
67
4.3k
Navigating Team Friction
lara
183
14k
Practical Orchestrator
shlominoach
186
10k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Documentation Writing (for coders)
carmenintech
65
4.4k
Typedesign – Prime Four
hannesfritz
40
2.4k
YesSQL, Process and Tooling at Scale
rocio
168
14k
Transcript
3Y4XJGUษڧձ !HPNJ@OJOHFO NJOVUFTSFDJQFPG3Y4XJGU 1"350CTFSWFS0CTFSWBCMF#FIBWJPS4VCKFDU
ࣗݾհ ϥϏοτϋεࣾͰಇࣾ͘ச৽ੜ ɾ+BWB 4FSWMFUɾ'8 ɾ4DBMB 1MBZ όοΫΤϯυ։ൃ ɾJ044XJGUΞϓϦ৽ن։ൃɹͳͲ
ɾ͖ͳݴޠ+BWB 4DBMB $ʢ͓ࣄ͓ͪͯ͠·͢ʣ ɾ͖ͳ࡞͝จ͏͗͞Ͱ͔͢ ɾJ04։ൃܦݧ·ͩ΄ͲͳͷͰجຊతʹૉਓͰ͢ 🐰͕࣌ؒͳ͍ͷͰࣗݾհׂѪ͠·͢🐰 !HPNJ@OJOHFO
ࠓ͢༰ 3Y4XJGUͷ0CTFSWFSؔ࿈جຊ෦ΛͰ࡞ΔϨγϐʂ ͰऴΘΔͱݴ͍ͬͯͳ͍ 0CTFSWFSύλʔϯͷ෮शʢʣ ͜Ε͕Θ͔Βͳ͍ͱҙຯෆ໌ͳΛ͢ΔͷͰɺͰ͓͞Β͍͢Δ 0CTFSWFS
0CTFSWBCMF*'ͷఆٛʢʣ 4XJGUͷݴޠ༷ͷ͍ͤͰɺͪΐͬͱ໘ͳ࣮Λ͢Δඞཁ͕͋Δ #FIBWJPS4VCKFDUͷ࣮ʢʣ 5ܕͷঢ়ଶΛ؍ଌͰ͖Δ؆୯ͳ0CTFSWBCMF۩ΫϥεΛ࡞͢Δ ޙɺผͷػձ͕͋ΕɺίϯϏωʔλ4DIFEVMFSͷ͍ͨ͠ ʢ͡Όશͯͷઆ໌Λ͢Δͷແཧʣ
ҙࣄ߲ • ͜Ε͔Β͢༰Λཧղ͠ͳͯ͘3Y4XJGUे ͑ΔϥΠϒϥϦͰ͢ʢΑ͔͘ΒΜͱࢥͬͨਓฉ͖ͳ͕ͯ͠΄͍͠ʣ • ·ͩ3YܥͷϥΠϒϥϦΛͬͨ͜ͱ͕ͳ͍ํɺ·ͣ ϥΠϒϥϦΛͬͯΈ͍ͯͩ͘͞ ·ͣ6*#VUUPOͷΠϕϯτϋϯυϦϯάΛ3YͰߦ͏ͱ͜Ζ͔Β࢝ΊͯΈΑ͏ʂ
• ͓ͷதͰొ͢Δ࣮3Y4XJGUͷͷͰ͋Γɺଞ ݴޠͷ3YϥΠϒϥϦͱ࣮͕ҟͳΔ߹͕͋Γ·͢
0CTFSWFSύλʔϯͷ෮श (P'ͷσβύλຊΛಡΜͰ͍ͩ͘͞
࣍ͷΑ͏ͳΛղܾ͢ΔͨΊʹͲ͏ͨ͠ΒΑ͍Ͱ͠ΐ͏͔ʁ "ʹมԽ͕ى͖ͨΒɺ#ʹ͍͑ͨ
࣍ͷΑ͏ͳΛղܾ͢ΔͨΊʹͲ͏ͨ͠ΒΑ͍Ͱ͠ΐ͏͔ʁ "ʹมԽ͕ى͖ͨΒɺ#ʹ͍͑ͨ ݱ࣮ੈքͰ͜͏͍͏έʔε͋Δͣ ɾ༧ఆ͕มΘͬͨͷͰʢঢ়ଶભҠʣ͓ళͷ༧ΛऔΓফ͢ʢ௨ʣ ɾࠁͦ͠͏ʹͳͬͨΒʢঢ়ଶભҠʣ্࢘ʹ࿈བྷ͢Δʢ௨ʣ
͜ΕΒΛ࣮ݱ͢ΔͨΊʹɺ૬खͷ࿈བྷઌΛ͍ͬͯͳ͍ͱ͍͚ͳ͍ ϓϩάϥϛϯάʹ͓͍ͯɺ૬खͷࢀরΛอ͍࣋ͯ͠ͳ͍ͱ͍͚ͳ͍
ͷղ ࣍ͷΑ͏ͳΛղܾ͢ΔͨΊʹͲ͏ͨ͠ΒΑ͍Ͱ͠ΐ͏͔ʁ "ʹมԽ͕ى͖ͨΒɺ#ʹ͍͑ͨ
"͕#ͷΠϯελϯεΛอ࣋͠ɺ#ʹมߋΛ͑Δ ʢ͜ͷߏͰΛͪΌΜͱղܾͰ͖͍ͯΔͷͰਖ਼͍͠ʣ
࣍ͷΑ͏ͳΛղܾ͢ΔͨΊʹͲ͏ͨ͠ΒΑ͍Ͱ͠ΐ͏͔ʁ "ʹมԽ͕ى͖ͨΒɺ#ʹ͍͑ͨ ͨͩ͠ɺҟͳΔ*'Λ࣋ͬͨ௨ઌ͕૿͑Δ͜ͱ͕༧͞Ε͍ͯΔ
࣍ͷΑ͏ͳΛղܾ͢ΔͨΊʹͲ͏ͨ͠ΒΑ͍Ͱ͠ΐ͏͔ʁ "ʹมԽ͕ى͖ͨΒɺ#ʹ͍͑ͨ ͨͩ͠ɺҟͳΔ*'Λ࣋ͬͨ௨ઌ͕૿͑Δ͜ͱ͕༧͞Ε͍ͯΔ ݱ࣮ੈքͰྫ͑Δͱ ɾ"ɺ# $
%ͱͪ߹ΘͤΛ͍ͯ͠Δ ɾͪ߹ΘͤॴΛมߋ͍ͨ͠ͷͰɺมߋΛΒͤΔඞཁ͕͋Δ ɾ#UXJUUFS $ϝʔϧ %-*/&ͰΓͱΓΛ͢Δඞཁ͕͋Δ "ͦΕͧΕͷ*'Λ͍ͬͯͳ͍ͱ͍͚ͳ͍ͷͰେม
࣍ͷΑ͏ͳΛղܾ͢ΔͨΊʹͲ͏ͨ͠ΒΑ͍Ͱ͠ΐ͏͔ʁ "ʹมԽ͕ى͖ͨΒɺ#ʹ͍͑ͨ ͨͩ͠ɺҟͳΔ*'Λ࣋ͬͨ௨ઌ͕૿͑Δ͜ͱ͕༧͞Ε͍ͯΔ ઌ΄ͲͷղܾࡦͰԿ͕ϚζΠͷ͔ʁ ɾ௨ઌ͕૿ݮ͢Δͨͼʹ"ͷ෦Λมߋ͢Δඞཁ͕͋Δ ɾ௨ઌͷ*'ͷมߋʹΑΓ"ͷ෦Λมߋ͢Δඞཁ͕͋Δ
͜ͷɺ௨ݩ͕௨ઌͷΦϒδΣΫτͷৄࡉΛ ͍ͬͯΔ͜ͱʹΑͬͯੜ͡Δ
0CTFSWFSύλʔϯ ௨ઌʢ؍ଌऀ0CTFSWFSʣɺ ௨Λड͚͚ͭΔͨΊͷϝιουʢVQEBUFʣΛ͍࣋ͬͯΕྑͦ͞͏
QVMMܕ0CTFSWFSύλʔϯ ௨ݩ ؍ଌՄೳͳ0CTFSWBCMF ɺ ɾ0CTFSWFSͷ௨Λ։࢝͢ΔͨΊͷϝιουʢBUUBDIʣ ɾ0CTFSWFSͷ௨Λऴྃ͢ΔͨΊͷϝιουʢEFUBDIʣ ɾอ࣋͢Δ0CTFSWFSͨͪʹ௨ΛૹΔϝιουʢOPUJGZʣ Λ͍࣋ͬͯΕྑͦ͞͏
QVMMܕ0CTFSWFSύλʔϯ ͜ͷߏΛQVMMܕ0CTFSWFSύλʔϯͱ͍͏ 👉؍ଌऀ͕0CTFSWBCMFʹΛऔΓʹߦ͔ͳ͚ΕͳΒͳ͍ 👉ͦͷ͔ΘΓ*'୯७ʹͳΔ
QVTIܕ0CTFSWFSύλʔϯ ͜ͷߏΛQVTIܕ0CTFSWFSύλʔϯͱ͍͏ 👉0CTFSWBCMF͕ߋ৽͞Εͨ͝ͱ0CTFSWFS௨͢Δ
0CTFSWFS 0CTFSWBCMFͷఆٛ 4XJGUͷݴޠ༷ͷ͍ͤͰͭΒ͍͜ͱΛ͢Δඞཁ͕͋Γ·͢
جຊతͳΠϯλʔϑΣʔε جຊߏQVTIܕ0CTFSWFSύλʔϯͱಉ͡ 👉ͨͩ͠ɺ୯ͳΔͰͳ͘Πϕϯτ͕ߪಡͷରʹͳΔ 👉ΤϥʔྃΠϕϯτ͕ೖΔ͜ͱʹΑΓදݱྗ্͕͕Δ
&WFOUͷ࣮ ɾ࣍ͷঢ়ଶΛද͢/FYU ɾΤϥʔ͕ͨͨ͠Ί௨Λऴྃ͢Δ&SSPS ɾঢ়ଶભҠ͕ऴʹୡͨ͜͠ͱΛද͢$PNQMFUFE
👉&SSPSPS$PNQMFUFEͰΠϕϯτετϦʔϜ͕ด͡Δ
0CTFSWFS0CTFSWBCMF5ZQF ɾ4XJGUͷQSPUPDPMHFOFSJDUZQFQBSBNFUFSΛ࣋ͯͳ͍ ɾͭ·ΓQSPUPDPM0CTFSWFS&\^తͳͷ͕ఆٛͰ͖ͳ͍
0CTFSWFS0CTFSWBCMF5ZQF ɾ4XJGUͷQSPUPDPMHFOFSJDUZQFQBSBNFUFSΛ࣋ͯͳ͍ ɾQSPUPDPMXJUIBTTPDJBUFEUZQF BCTUSBDUDMBTTͰରԠ
ͳΜͰ͜ΜͳΫιΊΜͲ͍͘͜͞ͱΛ͍ͯ͠Δͷ͔
0CTFSWFS0CTFSWBCMF5ZQF ɾ0CTFSWFSʹ0CTFSWBCMFʹͳΕΔ4VCKFDUͷରԠ ɾΫϥεͷଟॏܧঝ͕Ͱ͖ͳ͍ͨΊʹQSPUPDPMΛΔඞཁ͕͋Δ
ɾ0CTFSWFS5ZQF0CTFSWBCMF5ZQF͜ͷͨΊʹඞཁ ɾ·ͣɺ👆͜ͷͭΛఆ͍͖ٛͯ͠·͠ΐ͏ 0CTFSWFS0CTFSWBCMF5ZQF
0CTFSWFS0CTFSWBCMF5ZQF
0CTFSWFS0CTFSWBCMF5ZQF
ɾ"OZ0CTFSWFS0CTFSWBCMFΛ࣮͢Δ ɾBTTPDJBUFEUZQFΛHFOFSJDUZQFQBSBNFUFS "OZ0CTFSWFS0CTFSWBCMF
ɾUZQFBMJBT&&MFNFOUͱPOͷҾܕ੍͕ϙΠϯτ ɾ؍ଌऀɺ؍ଌͨ͠ΠϕϯτΛॲཧ͢Ε0,ͳͷͰ࣮୯७ "OZ0CTFSWFS&MFNFOU
ɾUZQFBMJBTͱTVCTDSJCFͷҾܕ੍͕ϙΠϯτ ɾຊདྷͩͬͨΒBCTUSBDUDMBTTʹ͢Δ͖ͱ͜Ζ 0CTFSWBCMF&MFNFOU
#FIBWJPS4VCKFDUͷ࣮ ຯͳ࣮Λ୶ʑͱߦ͏ͷͰ͢ɻաͳظ͠ͳ͍Ͱ͍ͩ͘͞ɻ
#FIBWJPS4VCKFDU&ͱԿ͔ʁ ɾ&ܕͷΛঢ়ଶͱͯ࣋ͭ͠0CTFSWBCMFͳΦϒδΣΫτͷͻͱͭ ɾTVCTDSJCF PCTFSWFS ͢Δͱݱࡏͷঢ়ଶΛऔಘͰ͖Δͱͱʹ ɹมͷத͕มԽͨ͠ͱ͖ͦͷมߋ௨Λड͚Δ͜ͱ͕Ͱ͖Δ
#FIBWJPS4VCKFDU&ͷ࣮ ɾ&ܕͷͷϥούʔΫϥε ɾ0CTFSWBCMFͳͷͰTVCTDSJCFΛ࣮͢Δඞཁ͕͋Δ
#FIBWJPS4VCKFDU&ͷ࣮ ɾTVCTDSJCFͰPCTFSWFSΛίϨΫγϣϯಥͬࠐΉ ɹʢPCTFSWFSߪಡऀ௨ઌΛPCTFSWBCMF͕อ࣋͢Δʣ
#FIBWJPS4VCKFDU&ͷ࣮ ɾಉ࣌ʹߪಡΛղআ͢ΔͨΊͷΦϒδΣΫτ%JTQPTBCMFΛൃߦ ʢ4VCTDSJQUJPO%JTQPTBCMFʹVOTVCTDSJCFͷൃՐΛҕৡʣ
#FIBWJPS4VCKFDU&ͷ࣮ ɾಉ࣌ʹߪಡΛղআ͢ΔͨΊͷΦϒδΣΫτ%JTQPTBCMFΛൃߦ ʢ4VCTDSJQUJPO%JTQPTBCMFʹVOTVCTDSJCFͷൃՐΛҕৡʣ EJTQPTF ͰVOTVCTDSJCFΛൃՐͤ͞ΔΑ͏ͳ%JTQPTBCMFͷ࣮͕ඞཁ
VOTBGF"EESFTT0G "OZ0CKFDU ɾΠϯελϯεϝϞϦΛ֬อ͢Δʹ͋ΔछͷJEͷׂΛ࣋ͭ ɾ4XJGUVOTBGF"EESFTT0Gͦͷ൪ΛऔಘͰ͖Δ ɾ3Y4XJGUͰ͜ͷϋογϡΛ༻͍ͨΩʔʢ#BH,FZʣͱ ɹίϨΫγϣϯʢ#BHʣΛࣗલͰ࣮͍ͯ͠Δ ɹʢεϥΠυͰ؆୯ͷͨΊɺྻΛͬͨࡶͳ࣮ʹͯ͋͠Δʣ
DG 3Y4XJGU%BUB4USVDUVSFT#BHTXJGU
4VCTDSJQUJPO%JTQPTBCMFͷ࣮ ɾ4VCTDSJQUJPO%JTQPTBCMFͷ࣮ʹऔΓֻ͔Δ EJTQPTF ͰVOTVCTDSJCFΛൃՐͤ͞ΔΑ͏ͳ%JTQPTBCMFͷ࣮͕ඞཁ
4VCTDSJQUJPO%JTQPTBCMFͷ࣮ ɾ#FIBWJPS4VCKFDUͷऑࢀরͱPCTFSWFSΛಛఆ͢ΔΩʔΛอ࣋ ɾEJTQPTFͰ#FIBWJPS4VCKFDUͷVOTVCTDSJCFΛൃՐ
0CTFSWFS5ZQFϓϩτίϧͷద߹ ɾ͜ͷ··ͩͱ#FIBWJPS4VCKFDUΛঢ়ଶભҠͤ͞Δํ๏͕ͳ͍ ɾPO &WFOU Ͱঢ়ଶભҠΛͤ͞Δ͘0CTFSWFS5ZQFΛ࣮
ՌΛͱΓ͋͑ͣͬͯΈΔ ɾҎԼͷΑ͏ͳײ͡Ͱ0CTFSWFSύλʔϯΛͱΓ࣮͋͑ͣݱͰ͖Δ
Ռͷ ɾεϨουηʔϑͰͳ͍ 👉/43FDVSTJWF-PDLΛ͏͜ͱͰղܾ͢Δ ɾ&SSPS$PNQMFUFEͰΠϕϯτετϦʔϜ͕ด͡ͳ͍ 👉#FIBWJPS4VCKFDUʹରͯ͠EJTQPTFETUPQQFE&WFOU ɹϓϩύςΟΛՃͯ͠ɺదͳॲཧΛ࣮͢Δ ɾ4VCTDSJQUJPO%JTQPTBCMF͕#FIBWJPS4VCKFDUʹରͯ͠ ɹϋʔυίʔυ͞Ε͍ͯΔ
👉VOTVCTDSJCFΛ࣋ͭϓϩτίϧΛΓɺநґଘͤ͞Δ ɹʢ3Y4XJGUͷ4ZODISPOJ[FE6OTVCTDSJCF5ZQFʹ૬ʣ
εϨουηʔϑʹ͢ΔͨΊʹ ɾεϨουηʔϑʹ͢ΔͨΊʹ/43FDVSTJWF-PDLΛ༻͍Δ ɾ͋ΔεϨου͕MPDL͢ΔͱಉҰεϨουҎ֎͔ΒͷΞΫηεΛ ɹͨͤͯ͘ΕΔػೳΛ࣋ͭ ɾΞτϛοΫʹ͍ͨ͠෦ΛMPDL VOMPDLͰғΉ͚ͩͷઃܭ
εϨουηʔϑʹ͢ΔͨΊʹ ɾεϨουηʔϑʹ͢ΔͨΊʹ/43FDVSTJWF-PDLΛ༻͍Δ ɾ͋ΔεϨου͕MPDL͢ΔͱಉҰεϨουҎ֎͔ΒͷΞΫηεΛ ɹͨͤͯ͘ΕΔػೳΛ࣋ͭ ɾΞτϛοΫʹ͍ͨ͠෦ΛMPDL VOMPDLͰғΉ͚ͩͷઃܭ
3Y4XJGUͰEFGFSΛ্ͬͨهͷΑ͏ͳ࣮͕ʹͭ͘ ʢVOMPDLΕࢭͷͨΊͩͱࢥΘΕΔʣ
εϨουηʔϑʹ͢ΔͨΊʹ ɾ෦ঢ়ଶΛࢀরɾมߋ͢ΔՕॴʹMPDLΛࠩ͠ࠐΉ
·ͱΊ ɾ0CTFSWFS 0CTFSWBCMFͷ*'QVTIܕ0CTFSWFS ɹύλʔϯ͔Βࣗવʹಋ͘͜ͱ͕Ͱ͖Δ ɾQVTI͢ΔʹOFYU FSSPS DPNQMFUFEͱ͍͏ҙຯ͚Λ ɹ͢Δ͜ͱʹΑͬͯػೳੑΛ্͍ͤͯ͞Δͷ͕ಛత
ɾߪಡղআͷΈΛ%JTQPTBCMFʹҕৡ͍ͯ͠Δͷ͕ಛత ͳ͓ɺࠓͬͨ͜ͱͱεϥΠυͷ༰͔ͳΓઆ໌ෆͳͷͰɺڵຯ Λ࣋ͨΕͨํҎԼͷهࣄΛ͝ཡ͍͚ͨͩΔͱ͍Ͱ͢ IUUQRJJUBDPNHPNJ@OJOHFOJUFNTEDBBCFBBFC
ͦͷଞ3Y4XJGUʹؔ͢Δ׆ಈ 3Y4XJGUؔ࿈ͷهࣄɺଟॻ͍ͯ·͢ͷͰΑΖ͓͘͠ئ͍͠·͢🙏 <2JJUB>J04ΞϓϦ։ൃࣄྫͷ͝հ IUUQRJJUBDPNHPNJ@OJOHFOJUFNTCCBCE <$>هࣄ͝จ3YͰ͔͢ /"/"," *OTJEF13&44WPMʢୈ̓։ൃηΫγϣϯʣ
IUUQTTJUFTHPPHMFDPNTJUFEBJTFD <χίφϨ>3Y4XJGUΛ༻͍ͨΞϓϦ։ൃͷ࣮ફ IUUQOJDPOBSFOJDPWJEFPKQXBUDILO ͦͷଞɺ3Y4XJGUؔ࿈ͷωλͨ͘͞Μ͋ΔͷͰɺԿ͔ػձ͕͋ͬͨΒݺΜͰ͍ͩ͘͞