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
Compose駆動開発のためのマルチモジュール化
Search
kobayashi_kento
October 26, 2023
0
180
Compose駆動開発のためのマルチモジュール化
2023年10月26日(木)開催のpixiv App Nightで発表した資料です。
kobayashi_kento
October 26, 2023
Tweet
Share
More Decks by kobayashi_kento
See All by kobayashi_kento
Kotlinの好きなところ
kobaken0029
0
480
DataStoreを導入してみた
kobaken0029
1
280
Epoxyを用いたレイアウト構築術
kobaken0029
1
210
Androidエンジニアが1週間でiOSアプリ開発を学び、1ヶ月で大規模アプリ開発にJOINした話
kobaken0029
0
3k
Modern REST Communicate for Android
kobaken0029
0
1.5k
AndroidでモダンREST通信してみたった
kobaken0029
0
250
Featured
See All Featured
Writing Fast Ruby
sferik
628
61k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Faster Mobile Websites
deanohume
305
30k
It's Worth the Effort
3n
183
28k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
GitHub's CSS Performance
jonrohan
1030
460k
Embracing the Ebb and Flow
colly
84
4.5k
How GitHub (no longer) Works
holman
311
140k
Automating Front-end Workflow
addyosmani
1366
200k
Transcript
@kobaken Composeۦಈ։ൃͷͨΊͷ ϚϧνϞδϡʔϧԽ
ࣗݾհ • kobakenʢ@koba_dog_ʣ • ίϛοΫࣄۀ෦pixivίϛοΫ෦։ൃνʔϜ • AndroidΞϓϦΛ୲ • ࠷ۙRailsॻ͍ͯ·͢
None
pixivίϛοΫΞϓϦͷ։ൃঢ়گʹ͍ͭͯ • 20152݄ʹAndroidΞϓϦ͕ϦϦʔε • جຊతʹappϞδϡʔϧͰͯ͢ͷػೳ͕࣮͞Ε͍ͯͨ • ՝ۚपΓͷॲཧ͕ผϞδϡʔϧͰΓ͚ΒΕ͍ͯͨఔ • 202310݄ݱࡏɺAndroidΞϓϦΤϯδχΞ3ਓମ੍
ϚϧνϞδϡʔϧԽͷϞνϕʔγϣϯ • pixivίϛοΫΞϓϦͰJetpack ComposeΛಋೖ͢Δ͜ͱʹ • ࣮ࡍʹಋೖͯ͠ΈΔͱϓϨϏϡʔ͕͍ • ΄΅ͯ͢ͷґଘ͕ؔappϞδϡʔϧͰ͍݁ͯ͠ΔͨΊ • Composeͷ։ൃମݧΛվળ͍ͨ͠
ϚϧνϞδϡʔϧԽΛਐΊΔલʹ • ϚϧνϞδϡʔϧԽ੍ͱͯ͠॥ࢀরNG͕͋ΔͷͰܭըతʹਐΊͯ ͍͘ඞཁ͕͋Δ • νʔϜ։ൃͷ߹ɺํڞ༗ͷͨΊʹਤʹى͍ͯ͘͜͠
pixivίϛοΫͰͷϞδϡʔϧઃܭ • app • feature • core
appϞδϡʔϧ pixivίϛοΫͰͷϞδϡʔϧઃܭ ΞϓϦશମͷΤϯτϦϙΠϯτͱͳ ΔϞδϡʔϧɻ ɾApplicationΫϥεΤϯτϦͱͳ ΔActivity͕ஔ͞ΕΔɻ ɾϏϧυόϦΞϯτͷΓସ͑୲ ɻ ɾҠߦظؒதશͯͷϞδϡʔϧͷ ґଘؔΛ࣋ͪɺDI͜͜Ͱߦ͏ɻ
featureϞδϡʔϧ pixivίϛοΫͰͷϞδϡʔϧઃܭ ֤ػೳͷ࣮͕ஔ͞ΕΔϞδϡʔ ϧɻ :feature:${ػೳ໊}:presentation ActivityViewModelΛஔɻ :feature:${ػೳ໊}:compose ࠓճͷ؊ɻػೳ༝དྷͷCompose࣮ Λஔɻޙड़͢Δcommonuiͱ ͍ͬͨ࠷খݶͷґଘؔͷΈɻ
coreϞδϡʔϧ pixivίϛοΫͰͷϞδϡʔϧઃܭ ModelutilܥͳͲڞ௨ϩδοΫ͕ ஔ͞ΕΔϞδϡʔϧɻ :core:data:model σʔλܕΛදݱ͢ΔModelΛஔɻ :core:data:repository RepositoryΛஔɻσʔλͷऔಘߋ ৽ͳͲɻ࣮ࡍʹ௨৴ͨ͠ΓɺDBͳ ͲϩʔΧϧϑΝΠϧʹΞΫηε͢Δ
ॲཧܥޙड़͢Δinfraʹஔ͢Δɻ
coreϞδϡʔϧ pixivίϛοΫͰͷϞδϡʔϧઃܭ ModelutilܥͳͲڞ௨ϩδοΫ͕ ஔ͞ΕΔϞδϡʔϧɻ :core:infra:local DBDataStoreɺϑΝΠϧૢ࡞ܥͳ ͲΛஔɻ :core:infra:remote APIΫϥΠΞϯτResponseͷܕఆ ٛͳͲΛஔɻ
coreϞδϡʔϧ pixivίϛοΫͰͷϞδϡʔϧઃܭ ModelutilܥͳͲڞ௨ϩδοΫ͕ ஔ͞ΕΔϞδϡʔϧɻ :core:network ωοτϫʔΫଓʹؔ͢Δॲཧ൚ ༻ResponseͳͲΛஔɻ :core:analytics FirebaseͷΠϕϯτϩάૹ৴ϩ δοΫΛஔɻ
coreϞδϡʔϧ pixivίϛοΫͰͷϞδϡʔϧઃܭ ModelutilܥͳͲڞ௨ϩδοΫ͕ ஔ͞ΕΔϞδϡʔϧɻ :core:ui ComposeͷThemeΧϥʔύϨο τɺ൚༻ComposableΛஔɻ :core:common ଞͷcoreʹؔ͢ΔϞδϡʔϧʹଐ͞ ͳ͍൚༻ॲཧܥΛஔɻ
None
࣮ߦ • খ࢝͘͞Ί͍ͯ͘ • ຊདྷͷతͰ͋ΔʮCompose։ൃମݧͷվળʯΛҙࣝ • ·ͣ:feature:${ػೳ໊}:compose͔Βணख • appϞδϡʔϧʹ͋ΔModelʹґଘ͠ͳ͍Α͏ʹcomposeϞδϡʔϧ ͰUIStateΛఆٛ
࣮ྫ :appͰࢀর͍ͯͨ͠Model ͱ૬ޓมͰ͖ΔUIͷͨΊ ͷܕΛ:composeͰ࠶ఆٛ
࣮ྫ :featureʹViewModelͷ interfaceΛઃ͚ͯରԠ͢Δ ͷOK
࣮ࡍʹҠߦͯ͠Έͨ݁Ռ…
ͱ͋ΔҰը໘ͷ composeϞδϡʔϧͷҠߦલޙͷϓϨϏϡʔʹ͔͔Δ࣌ؒ
ࠓޙͷల • coreϞδϡʔϧͷׂ • ModelRepositoryɺͦͷଞڞ௨ॲཧͷҠߦ • ֤ը໘ΛfeatureϞδϡʔϧׂ • ActivityViewModel࣮Λ:feature:presentationʹҠߦ͢Δ
·ͱΊ • ComposeΛϞδϡʔϧׂͨ͜͠ͱͰϓϨϏϡʔΛվળͨ͠ • Compose͚ͩͷׂͳΒҊ֎ؾܰʹߦಈʹҠͤΔ • ϚϧνϞδϡʔϧ͕ఆ͞Εͯͳ͍தنҎ্ͷϓϩδΣΫτͰͷϚϧ νϞδϡʔϧԽେม • ϓϩδΣΫτنʹΑΔ͕ɺࣄલͷܭը͕େࣄ
• ҰؾʹΖ͏ͱͤͣʹͪΐͬͱͣͭਐΊΔͷ͕٢
AndroidΞϓϦΛ Ұॹʹ։ൃͯ͘͠ΕΔ ਓΛืू͍ͯ͠·͢ʂ ΧδϡΞϧ໘ஊͷ͓Βͤ ϚϧνϞδϡʔϧComposeͳͲ ͳΜͰ͓ؾܰʹ ԼهQRίʔυ͔ΒΧδϡΞϧ໘ஊ ͓͓ͪͯ͠Γ·͢