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
170
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
410
DataStoreを導入してみた
kobaken0029
1
270
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
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Done Done
chrislema
181
16k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Building an army of robots
kneath
302
43k
Agile that works and the tools we love
rasmusluckow
327
21k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Writing Fast Ruby
sferik
627
61k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Cult of Friendly URLs
andyhume
78
6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
GraphQLとの向き合い方2022年版
quramy
43
13k
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ίʔυ͔ΒΧδϡΞϧ໘ஊ ͓͓ͪͯ͠Γ·͢