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
ネイティブアプリでもFluxしたい
Search
Kenichi Yonekawa
April 08, 2016
Programming
0
2.1k
ネイティブアプリでもFluxしたい
http://connpass.com/event/28794/
Kenichi Yonekawa
April 08, 2016
Tweet
Share
More Decks by Kenichi Yonekawa
See All by Kenichi Yonekawa
iOSアプリの設計とDependency Injection
yonekawa
22
16k
Fluxで複雑な状態の変化を予測可能にするiOSアプリ開発
yonekawa
9
19k
freeeモバイルチームの変遷と進化
yonekawa
0
7.4k
ReactiveCocoa Pitfalls at freee
yonekawa
2
830
RAC用クラス拡張の作り方
yonekawa
2
2.9k
Dive into Joybox
yonekawa
5
1.7k
Other Decks in Programming
See All in Programming
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
0
160
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.1k
Java ジェネリクス入門 2024
nagise
0
610
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
1
290
CSC509 Lecture 09
javiergs
PRO
0
110
Macとオーディオ再生 2024/11/02
yusukeito
0
200
役立つログに取り組もう
irof
26
8.7k
現場で役立つモデリング 超入門
masuda220
PRO
13
2.9k
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
400
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
390
僕がつくった48個のWebサービス達
yusukebe
18
17k
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
GitHub's CSS Performance
jonrohan
1030
460k
Rails Girls Zürich Keynote
gr2m
93
13k
Fireside Chat
paigeccino
32
3k
Unsuck your backbone
ammeep
668
57k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Statistics for Hackers
jakevdp
796
220k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Embracing the Ebb and Flow
colly
84
4.4k
Writing Fast Ruby
sferik
626
61k
The Language of Interfaces
destraynor
154
24k
Transcript
@yonekawa ωΠςΟϒΞϓϦͰ 'MVY͍ͨ͠
ʔ͍ϑϩϯτΤϯυͷ ษڧձͰ4XJGUͷ͢ΔΑʔ
ࡢࠓͷiOSΞϓϦ • RxSwiftʢϦΞΫςΟϒϓϩάϥϛϯάʣ͕ྲྀߦͷஹ͠ • MVVMΞʔΩςΫνϟ͕ຊ֨తʹྲྀߦ͖ͬͯͯΔ • ViewModelͰAPIୟ͍ͯViewʹྲྀ͠ࠐΉ • RxSwiftUIόΠϯσΟϯά༻ͷΈ͕ॆ࣮
freeeͷiOSΞϓϦ • MVVMΛॳظ͔Βಋೖ͠ɺViewModelʹΑͬͯViewͷঢ়ଶ ͱϏδωεϩδοΫΛཧ͍ͯ͠Δ • ϦΞΫςΟϒϓϩάϥϛϯάʹReactiveCocoaΛ͍ͬͯ Δ • ෳࡶͳೖྗϑΥʔϜɺػೳͷଟ͞ͱͦΕΒͷؔ࿈ͷଟ͞
՝ײ • ن͕େ͖͘ͳΔʹͭΕͯUIΠϕϯτɺγεςϜΠϕϯτʹ ΑΔڍಈΛίϯτϩʔϧͰ͖ͳ͘ͳ͖ͬͯͨ • ViewModelͱͷํόΠϯσΟϯάͱͦΕΒͷґଘؔ ͷ༧ଌͷͮ͠Β͞ • ঢ়ଶͷཧͱϞσϧͷૢ࡞ͱAPIૢ࡞͕ີ݁߹
Ͳ͜ͰԿ͕ى͖ͯΔ͔Α͘ Θ͔ΒΜ
୭͔ॿ͚ͯ͘Ε
None
͓ͬʁ
Ǒ2way-bindingͰɺViewModelͰViewͷ Modelͷཧ͠ͳ͍ͱ͍͚ͳ͍ͱ ͜Ζ͕ͭΒ͞ͷݪҼʹͳ͍ͬͯΔɻ ǒ
Θ͔Δɻ
Ǒ͡Ό͋ͦͦViewΛඳը͢Δͱ͖ʹɺ Modelͷঢ়ଶ͔Βશ෦࠶ඳը͢Ε͍͍Μ ͡Όͳ͍ʁ ͦͨ͠ΒModelͷΛཧ͢Δ͚ͩͰྑ͘ ͳͬͯɺViewͷߟ͑ͳͯ͘Α͘ͳΔΜ ͡Όͳ͍ʁ ǒ
Ǒ͜ΕʹϐλϦͱ·Δͷ͕Fluxͱ͍͏֓೦ Ͱɺ͜ΕViewͷதͰͷͷมߋΛͦͷ· ·ViewͰॲཧΛͤͣɺผͷʹྲྀ͠ࠐΈ ·͢ɻ ǒ
ͳΔ΄Ͳʁ
SwiftFlux͍ͬͯ͏ϥΠϒϥϦΛ࡞ͬͨΑ • https://github.com/yonekawa/SwiftFlux • DispatcherͱͦΕʹඥͮ͘Action/StoreͷநԽ • ReduceStoreͱ͔Flux UtilsҰ෦࣮ͯ͠Δ • ϓϩτίϧࢦͰSwiftΒ͠͞Λҙࣝ
࣮ઓೖͯ͠ΔΑ https://itunes.apple.com/jp/app/id1037197002
୯ํϑϩʔ with ܕ੍ TUSVDU$SFBUF5PEP"DUJPO\ UZQFBMJBT1BZMPBE5PEP GVODJOWPLF EJTQBUDIFS%JTQBUDIFS \ MFUUPEP5PEP UJUMF/FX5P%P
EJTQBUDIFSEJTQBUDI TFMG SFTVMU3FTVMU WBMVFUPEP ^ ^ DMBTT5PEP4UPSF4UPSF#BTF\ QSJWBUF TFU WBSUPEP5PEP JOJU \ SFHJTUFS $SFBUF5PEPTFMG \ SFTVMU JO TXJUDISFTVMU\ DBTF4VDDFTT MFUWBMVF UPEPWBMVF FNJU$IBOHF EFGBVMU CSFBL ^ ^ ^ ^
ΞϓϦͷ։ൃํ • جຊతʹViewControllerͱ1:1ͰStoreΛ࡞Γঢ়ଶΛཧ͢Δ • ͦΕͱผͰΞϓϦέʔγϣϯશମͷঢ়ଶʢೝূ͍ͯ͠Δͱ͔ʣ Λཧ͢ΔStoreΛ࡞Δ • APIϦΫΤετActionͰߦ͍݁ՌΛActionͷPayloadͱͯ͠ ѻ͏ •
Realm(DB)ͷอଘΞϓϦέʔγϣϯͷঢ়ଶมԽͱΈͳ͠ StoreͰߦ͏
Viewͷߋ৽Ͳ͏͢Δʁ • SwiftͷੈքʹReact͕ଘࡏ͠ͳ͍ɻͦΕͬΆ͍ͷ͍͘ ͔ͭ͋Δ͕ɺStoryboradͳͲϓϥοτϑΥʔϜ͕ఏڙ͢Δ ͷ͔Β֎ΕΔͷϦεΫ͕ߴ͍ • ͋ΔఔUIKit͕ޮΑ͘࠶ඳըͯ͘͠ΕΔ͕ɺ UITableViewͳͲΛ͏·ࠩ͘ߋ৽͢ΔΈ͕΄͍͠ • ࠓࣗͰஸೡʹࠩߋ৽Λߦ͏ํ
Τϥʔॲཧ • ActionͷPayloadͰErrorΦϒδΣΫτΛStoreʹ͠ɺStore ͕ঢ়ଶͱͯ͠อ࣋ • Τϥʔঢ়ଶΛม͑ΔActionͱͯ͠ѻ͏͖͔ • ͍·ͷSwiftFluxSwift2ͷthrowsΛ͏·͍͑ͯ͘ͳ͍
Ξχϝʔγϣϯ • ۪ʹΔͱFluxͷϑϩʔ͕େྔʹճΔ • Ξχϝʔγϣϯͷεςʔλεʢ։࢝ɺऴྃʣΛঢ়ଶͱͯ͠ѻ ͏͖͔ • JSͷํʑͲ͏ઃܭͯ͠ΔΜͰ͔͢Ͷʁ
ଞʹ͜͏͍͏ϥΠϒϥϦ ແ͍ͷʁ
ReSwift • https://github.com/ReSwift/ReSwift • Swift൛Reduxɻ࠷ۙ͞Ε͖ͯͯΔɻ • SwiftFluxͰStoreGroupΛ࡞ͬͯࣅͨΑ͏ͳ͜ͱΛΖ͏ ͱͯ͠Δ͚Ͳ͜Ε͔Β
ࢀߟϦϯΫ SwiftFluxͰෳࡶͳঢ়ଶͷมԽΛ༧ଌՄೳʹ͢ΔiOSΞϓϦ։ൃ http://qiita.com/yonekawa/items/c8a53d534084850963a3
ωΠςΟϒΞϓϦͷ ϑϩϯτΤϯυେมͰɻ