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
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Contemporary Test Cases
maaretp
0
140
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
subpath importsで始めるモック生活
10tera
0
320
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Jakarta EE meets AI
ivargrimstad
0
150
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
150
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
200
C++でシェーダを書く
fadis
6
4.1k
Featured
See All Featured
Unsuck your backbone
ammeep
668
57k
Building an army of robots
kneath
302
43k
Practical Orchestrator
shlominoach
186
10k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Adopting Sorbet at Scale
ufuk
73
9.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
4 Signs Your Business is Dying
shpigford
180
21k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Visualization
eitanlees
145
15k
BBQ
matthewcrist
85
9.3k
A designer walks into a library…
pauljervisheath
204
24k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
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
ωΠςΟϒΞϓϦͷ ϑϩϯτΤϯυେมͰɻ