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
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
Recoilを剥がしている話
kirik
5
6.6k
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Haze - Real time background blurring
chrisbanes
1
510
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
700
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
103 Early Hints
sugi_0000
1
230
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
RailsConf 2023
tenderlove
29
940
Become a Pro
speakerdeck
PRO
26
5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
A better future with KSS
kneath
238
17k
Being A Developer After 40
akosma
87
590k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Optimizing for Happiness
mojombo
376
70k
BBQ
matthewcrist
85
9.4k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Facilitating Awesome Meetings
lara
50
6.1k
KATA
mclloyd
29
14k
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
ωΠςΟϒΞϓϦͷ ϑϩϯτΤϯυେมͰɻ