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
Eight iOSを支えるアーキテクチャ
Search
Masashi
June 15, 2019
Programming
1
600
Eight iOSを支えるアーキテクチャ
Developers Boost KANSAI
https://event.shoeisha.jp/devboost/20190615
Masashi
June 15, 2019
Tweet
Share
More Decks by Masashi
See All by Masashi
これだけは伝えたい設計の技術
kawabe
0
1.2k
EightのUI Component化の取り組み
kawabe
0
120
Other Decks in Programming
See All in Programming
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
130
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.7k
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.2k
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
400
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
1k
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
110
Package Traits
ikesyo
1
180
MCP with Cloudflare Workers
yusukebe
2
300
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
400
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
400
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
0
190
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
220
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Code Reviewing Like a Champion
maltzj
521
39k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Producing Creativity
orderedlist
PRO
343
39k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Unsuck your backbone
ammeep
669
57k
GitHub's CSS Performance
jonrohan
1030
460k
Making the Leap to Tech Lead
cromwellryan
133
9k
Designing for humans not robots
tammielis
250
25k
A designer walks into a library…
pauljervisheath
205
24k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
Transcript
ɹ&JHIUJ04Λࢧ͑ΔΞʔΩςΫνϟ Տลխ࢙ 4BOTBOגࣜձࣾ
Տลխ࢙ɹMasashi Kawabe Sansanגࣜձࣾ Eightࣄۀ෦ Engineering Group iOS ΤϯδχΞ 20184݄ Sansanגࣜձࣾ৽ଔೖࣾ
Eight iOS ͷ։ൃʹैࣄ
2018/04 2018/07 2018/12 2019/02 2019/04 2019/06 Sansanגࣜձࣾ ৽ଔೖࣾ / Eightࣄۀ෦ଐ
ϝϯγϣϯػೳͷ࣮ Eight iOS v9.0.0 ϦϦʔε Sansanࣄۀ෦ҟಈ Sansan iOS v5.0.0 ϦϦʔε / Eightࣄۀ෦ҟಈ ೋஈ֊ೝূػೳͷ࣮
2018/04 2018/07 2018/12 2019/02 2019/04 2019/06 Sansanגࣜձࣾ ৽ଔೖࣾ / Eightࣄۀ෦ଐ
ϝϯγϣϯػೳͷ࣮ Eight iOS v9.0.0 ϦϦʔε Sansanࣄۀ෦ҟಈ Sansan iOS v5.0.0 ϦϦʔε / Eightࣄۀ෦ҟಈ ೋஈ֊ೝূػೳͷ࣮
None
2018/04 2018/07 2018/12 2019/02 2019/04 2019/06 Sansanגࣜձࣾ ৽ଔೖࣾ / Eightࣄۀ෦ଐ
ϝϯγϣϯػೳͷ࣮ Eight iOS v9.0.0 ϦϦʔε Sansanࣄۀ෦ҟಈ Sansan iOS v5.0.0 ϦϦʔε / Eightࣄۀ෦ҟಈ ೋஈ֊ೝূػೳͷ࣮
ϝϯγϣϯػೳͷ࣮ ओʹϝϯγϣϯͷදࣔɺΞϓϦىಈ࣌ʹදࣔ ͢Δػೳઆ໌ͷφϏήʔγϣϯ࣮Λ୲
2018/04 2018/07 2018/12 2019/02 2019/04 2019/06 Sansanגࣜձࣾ ৽ଔೖࣾ / Eightࣄۀ෦ଐ
ϝϯγϣϯػೳͷ࣮ Eight iOS v9.0.0 ϦϦʔε Sansanࣄۀ෦ҟಈ Sansan iOS v5.0.0 ϦϦʔε / Eightࣄۀ෦ҟಈ ೋஈ֊ೝূػೳͷ࣮
Eight iOS v9.0.0 ϦϦʔε ओʹձࣾϑΥϩʔҰཡը໘ɺձࣾϑΥϩʔɾ ΞϯϑΥϩʔػೳɺ͓Βͤը໘ɺϑΟʔυ UI ৽ɺ UI Component
ಋೖΛ୲
2018/04 2018/07 2018/12 2019/02 2019/04 2019/06 Sansanגࣜձࣾ ৽ଔೖࣾ / Eightࣄۀ෦ଐ
ϝϯγϣϯػೳͷ࣮ Eight iOS v9.0.0 ϦϦʔε Sansanࣄۀ෦ҟಈ Sansan iOS v5.0.0 ϦϦʔε / Eightࣄۀ෦ҟಈ ೋஈ֊ೝূػೳͷ࣮
Sansan iOS v5.0.0 ϦϦʔε ओʹ໊Ұཡը໘ͷ࣮ɺ UI Component ಋೖΛ୲
2018/04 2018/07 2018/12 2019/02 2019/04 2019/06 Sansanגࣜձࣾ ৽ଔೖࣾ / Eightࣄۀ෦ଐ
ϝϯγϣϯػೳͷ࣮ Eight iOS v9.0.0 ϦϦʔε Sansanࣄۀ෦ҟಈ Sansan iOS v5.0.0 ϦϦʔε / Eightࣄۀ෦ҟಈ ೋஈ֊ೝূػೳͷ࣮
໊ࡱӨ ࿈བྷઌҰཡ ϑΟʔυ ϓϨϛΞϜػೳ
໊ࡱӨ ࿈བྷઌҰཡ ϑΟʔυ ϓϨϛΞϜػೳ ը໘ʹө͢Δঢ়ଶ͕ଟ͘ෳࡶ
ઃܭͱʁ ؔ৺ͷʹΑͬͯɺෳࡶͳΛ ୯७ͳͷ܈ͱͯ͠Γ͚Δ͜ͱ Ҿ༻J04ΞϓϦઃܭύλʔϯೖ IUUQTQFBLTDDCPPLTJ04@BSDIJUFDUVSF
αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ɺ ਓใΛ࣋ͭ Entity ʹ parse ͯ͠ɺΩϟογϡʹ औಘͨ͠ใΛอଘͯ͠ɺ View ʹදࣔ͢Δ
αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ɺ ਓใΛ࣋ͭ Entity ʹ parse ͯ͠ɺΩϟογϡʹ औಘͨ͠ใΛอଘͯ͠ɺ View ʹදࣔ͢Δ ෳࡶ
௨৴͍ͨ͠ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ɺ ਓใΛ࣋ͭ Entity ʹ parse ͯ͠ɺΩϟογϡʹ औಘͨ͠ใΛอଘͯ͠ɺ View ʹදࣔ͢Δ
σʔλΛΈཱ͍ͯͨ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ɺ ਓใΛ࣋ͭ Entity ʹ parse ͯ͠ɺΩϟογϡʹ औಘͨ͠ใΛอଘͯ͠ɺ View ʹදࣔ͢Δ
σʔλΛอଘ͍ͨ͠ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ɺ ਓใΛ࣋ͭ Entity ʹ parse ͯ͠ɺΩϟογϡʹ औಘͨ͠ใΛอଘͯ͠ɺ View ʹදࣔ͢Δ
ϨΠΞτ͍ͨ͠ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ɺ ਓใΛ࣋ͭ Entity ʹ parse ͯ͠ɺΩϟογϡʹ औಘͨ͠ใΛอଘͯ͠ɺ View ʹදࣔ͢Δ
௨৴͍ͨ͠ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ σʔλΛΈཱ͍ͯͨ ਓใΛ࣋ͭ Entity ʹ parse ͢Δ σʔλΛอଘ͍ͨ͠ Ωϟογϡʹऔಘͨ͠ใΛอଘ͢Δ
ϨΠΞτ͍ͨ͠ View ʹදࣔ͢Δ
ઃܭΛ͢Δࡍʹཱͭͷ͕ઃܭύλʔϯ ༗໊ͳͷɺ GoF ͷ 23ݸͷσβΠϯύλʔϯ
ઃܭύλʔϯΛΔϝϦοτ - ࠶ར༻ੑͷߴ͍ॊೈͳઃܭ͕Ͱ͖Δ - ։ൃऀؒͷҙࢥૄ௨͕༰қʹͳΔ https://www.techscore.com/tech/DesignPattern/foundation/foundation1.html/#dp0-3 YYYύλʔϯͰ͢
ΞʔΩςΫνϟύλʔϯ - ΞϓϦΛಈ͔͢ͱ͍͏ෳࡶͳɺେ·͔ͳෳͷʢ୯७ͳʣʹ Γ͚ΒΕΔ - ͦ͜Ͱ׆༻͞ΕΔͷ͕ΞʔΩςΫνϟ - Eight iOS Ͱ
MVVM ύλʔϯΛ࠾༻
ͳͥ MVVM Λ࠾༻ʁ αʔϏεͷॳظஈ֊໊ཧΞϓϦͩͬͨͨΊɺ MVC Ͱ ྑ͔͔ͬͨ͠Εͳ͍
ͳͥ MVVM Λ࠾༻ʁ - αʔϏε͕͢ΔʹͭΕͯɺSNS ػೳͷΑ͏ͳ ಈతʹঢ়ଶ͕มΘΔͷ͕૿͖͑ͯͨ - ඇಉظॲཧΛநԽ͢ΔͨΊʹར༻͍ͯ͠Δ RxSwift
ͷ binding ػߏΛ࠷େݶʹ׆͔͢͜ͱ͕ Ͱ͖Δ
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
"QQMF͕ఏڙ͢Δ6*,JUʹ6*7JFX$POUSPMMFSͱ͍͏7JFXΛཧ͢ΔΫϥε͕͋Γɺ ը໘ͷϥΠϑαΠΫϧͱը໘ભҠΛ୲͏
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
7JFX - " ͖͢͜ͱ - UI Λఆٛ͢Δ - ViewModel ʹ
UI Events Λ͑Δ - ViewModel ͔Βड͚औͬͨσʔλΛө͢Δ - # ͖͢Ͱͳ͍͜ͱ - ϓϨθϯςʔγϣϯϩδοΫΛఆٛ͢Δ - ௨৴σʔλૢ࡞Λߦ͏
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
7JFX.PEFM - " ͖͢͜ͱ - UI Events Λࢹ͠ɺModel ʹॲཧΛґཔ͢Δ -
Model ͔Βड͚औͬͨσʔλΛ View Ͱར༻͢Δͷʹ ࠷దͳܗʹՃ͢Δ - # ͖͢Ͱͳ͍͜ͱ - UI Λఆٛ͢Δ - ௨৴σʔλૢ࡞Λߦ͏
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
.PEFM - " ͖͢͜ͱ - σʔλߏΛఆٛ͢Δ - σʔλΛӬଓԽ͢Δ - σʔλΛૢ࡞͢Δ
- # ͖͢Ͱͳ͍͜ͱ - UI Λఆٛ͢Δ - σʔλΛ View Ͱར༻͢Δͷʹ࠷దͳܗʹՃ͢Δ
MVVM ύλʔϯ 7JFX 7JFX$POUSPMMFS 7JFX.PEFM .PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH
7JFX 7JFX$POUSPMMFS 7JFX.PEFM 6*&WFOUT 3FRVFTUT %BUB %BUB#JEJOH .PEFM &OUJUZ 3FQPTJUPSZ
3FRVFTU 6TF$BTF .PEFM
- Entity - σʔλߏΛఆٛ͢Δߏମ - Repository - Entity ͷ CRUD
ૢ࡞Λఏڙ͢Δ - SQLite UserDefaults ͷ DataSource ΛӅṭ - Request - HTTP Request Λ͛ΔॲཧΛఆٛ͢Δ - UseCase - ϏδωεϩδοΫΛهड़͢Δ
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
௨৴͍ͨ͠ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ σʔλΛΈཱ͍ͯͨ ਓใΛ࣋ͭ Entity ʹ parse ͢Δ σʔλΛอଘ͍ͨ͠ Ωϟογϡʹऔಘͨ͠ใΛอଘ͢Δ
ϨΠΞτ͍ͨ͠ View ʹදࣔ͢Δ
௨৴͍ͨ͠ αʔόʔ͔ΒϑΥϩʔ͍ͯ͠ΔਓϦετΛऔಘͯ͠ σʔλΛΈཱ͍ͯͨ ਓใΛ࣋ͭ Entity ʹ parse ͢Δ σʔλΛอଘ͍ͨ͠ Ωϟογϡʹऔಘͨ͠ใΛอଘ͢Δ
ϨΠΞτ͍ͨ͠ View ʹදࣔ͢Δ ίʔυΛݟͯΈ·͠ΐ͏$ ⚠આ໌ͷͨΊʹίʔυ؆ུԽ͍ͯ͠·͢
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
Entity ߏମͰσʔλΛఆٛ
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
Request 3FTQPOTFͷܕΛఆٛ
Request )551.FUIPEΛఆٛ
Request )551.FUIPEΛ͛Δ1BUIΛఆٛ
Request 3FTQPOTFΛड͚औͬͨࡍͷॲཧΛఆٛ
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
Repository 1SPUPDPM *OUFSGBDF Ͱ$36%ૢ࡞Λఆٛ
Repository ఆٛͨ͠$36%ૢ࡞Λ࣮
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
UseCase ۩ମܕͰͳ͘நʹґଘ *OJUJBMJ[FSͰґଘੑʢඞཁͳͷʣΛೖ
UseCase - ґଘؔٯసͷݪଇΛద༻ - มԽ͍͢͠۩Ͱͳ͘ɺ҆ఆͨ͠நʹґଘ - Dependency Injection Λద༻ -
Ϋϥεͷ֎͔Βґଘ͍ͯ͠ΔΛೖ - நʹґଘ͠ɺΫϥεͷ֎͔ΒඞཁͳͷΛೖ͢Δ͜ͱͰςελϒϧʹ
UseCase ϏδωεϩδοΫΛ࣮
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
ViewModel 7JFXͰදࣔ͢Δ&OUJUZΛެ։
ViewModel 7JFX͔Β6*&WFOUΛऔಘ
ViewModel .PEFMʹॲཧΛґཔ
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
View ը໘ىಈͷΠϕϯτΛ௨
View 7JFX.PEFMʹΠϕϯτΛ͑Δ
View 7JFX.PEFM͔Βड͚औͬͨ σʔλΛө
7JFX 7JFX$POUSPMMFS 3RVFTUT %BUB 6*&WFOUT %BUB#JEJOH 7JFX.PEFM 6TF$BTF 3FRVFTU 3FQPTJUPSZ
&OUJUZ 3FRVFTU 3FTQPOTF $36% %BUB 3FTVMU ,OPXTBCPVU ,OPXTBCPVU
·ͱΊ - Eight iOS Ͱ MVVM ύλʔϯΛ࠾༻ - ֤ͷ͖͢͜ͱɾ͖͢Ͱͳ͍͜ͱΛҙ࣮ࣝͯ͠ -
มԽ͍͢͠۩ͷґଘආ͚ɺநґଘ
None
None