Replies: 2 comments 2 replies
-
@opatry I am also following the same approach as yours , Using a seperate Compose Module for using in both android and desktop.I am.also using fonts, and assets using expect actual , if you want you can check out the project here: https://github.com/Shabinder/SpotiFlyer/tree/c9696fa4aa7f99f614bc1d65ae0a8dd5f223a4af |
Beta Was this translation helpful? Give feedback.
-
Hi, This is definitely something I'm conscious about (in this and also some other projects I have where there's even more Compose code that could be shared). I haven't really had chance yet to look at it but what you described sounds like it should work. I think I remember seeing that IntelliJ new project wizard allows creating multiplatform compose project so might be some inspiration there as well. |
Beta Was this translation helpful? Give feedback.
-
Hi 👋 .
First, many thanks for open sourcing this project, really helping new comers working on Kotlin Multiplatform 👏 .
I noticed you went for separate UI Compose implementation for Android and desktop.
Did you considered sharing some (or most?) composables between the two?
If so, do you have pros & cons to share?
I'm thinking about something like a
:common-compose
module storing shared composables,:app
and:desktop-app
modules having only Android integration and Windowed application integration depending no:common-compose
.I'm asking this because I'm currently working on this kind of approach and I was checking
PoepleInSpace
for inspiration 😅 .My main challenges are related to
drawable
,strings
andfont
abstraction.Given that I have more UI than real logic (small casual game), I'd like to share compose code as much as possible :)
So far, I tried to mimic Android API on desktop as much as possible (with the help of a Gradle task generating a
R.kt
from assets to mimic AndroidR.xxx.myresource_id
use) to share as much code as possible.Beta Was this translation helpful? Give feedback.
All reactions