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.2k
ネイティブアプリでも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.5k
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
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
1
140
Beyond ORM
77web
7
920
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
340
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
280
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
830
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
3
480
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
110
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
快速入門可觀測性
blueswen
0
370
Recoilを剥がしている話
kirik
5
6.8k
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Featured
See All Featured
Side Projects
sachag
452
42k
Bash Introduction
62gerente
608
210k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
KATA
mclloyd
29
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
It's Worth the Effort
3n
183
28k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
We Have a Design System, Now What?
morganepeng
51
7.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
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
ωΠςΟϒΞϓϦͷ ϑϩϯτΤϯυେมͰɻ