I'm building a new multi-project CMP app. In the p...
# android-architecture
r
I'm building a new multi-project CMP app. In the past, I've had good success with the Now in Android file structure for pure Android projects.
Copy code
nowinandroid/
├─ app/
├─ build-logic/
├─ core/
├─ feature/
I'm thinking of following a similar approach for CMP (similar to https://github.com/lihenggui/nowinkmp).
Copy code
newproject/
├─ androidApp/
├─ build-logic/
├─ core/
├─ feature/
├─ iosApp/
├─ shared/
What do you think of this approach? Is there an alternative file structure you'd recommend?
👍 1
a
most of projects ive seen follow this structure, its solid. One thing though is the core and shred folders, the names are too broad and they are not sugestive of the function they cary. In my experience this brings confusion to what has to go where. They can be called stuff with the same success, just core sounds more fancy.
👍 2
r
I ended up going with this approach and it's working nicely. 🙂 I do think I need a new name for the
shared
module.
core
makes sense because it's a parent module with submodules in it. The shared module includes the
App
entry point called by
androidApp
and
iosApp
. I'm planning to keep very little in there.
a
ah, so you can call shared as app if that has common entry points for android and ios, like iosApp(very specific) - app(shared entry point) this also can aggregate your all other modules, it should actually because when you think of it, intuitively the app contains a bunch of features(modules)
as of core, usually core is some ubiquitous thing every other modules would use (core-lib) rather than it would contain every other module (umbrela)
if you can put yourself in the place of a person who sees you codebase first time, would you be able to guess the function of the module just by looking at its name? I ask myself this question. If you can not do that than ask a friend or somebody else who havent seen it to tell you, thats the best test for the naming.
r
Agreed! So far I haven't heard any complaints with either
core
or
common
as a name for the shared modules. I always link to the Now in Android repo in the docs so folks have a reference.