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
The Language of Interfaces
destraynor
154
24k
Designing for Performance
lara
604
68k
Statistics for Hackers
jakevdp
796
220k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Code Reviewing Like a Champion
maltzj
520
39k
Automating Front-end Workflow
addyosmani
1366
200k
Docker and Python
trallard
40
3.1k
Into the Great Unknown - MozCon
thekraken
32
1.5k
4 Signs Your Business is Dying
shpigford
180
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
420
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ίʔυ͔ΒΧδϡΞϧ໘ஊ ͓͓ͪͯ͠Γ·͢