Hi all Has anyone built a CMP project with two var...
# multiplatform
n
Hi all Has anyone built a CMP project with two variants such as admin and user panel. I need to provide some different screens in each variant. I'm familiar with Android and implemented it before but don't know how to do the same in KMP and how to structure the main composeApp to include a directory for each variant.
d
I will advice you to create different project for each admin and user
👍 1
n
I hope to find a way. I don't want to repeat some parts of the code.
c
I would create different projects, trust me, however, create shared libraries for shared code. The main reason is deployment and config gets reallllly messy if you have multiple "apps" from a single project. Really one of the worst things they did with androidTargets which makes it difficult to configure vs java projects
👍 1
So for example I'm about to do the same for one of my projects, the admin portal will probably be web/desktop only where as customer facing is everything. You just force yourself to support more targets you don't need to otherwise. But auth/endpoints/http/models all shared
👍 1
n
Thank you @chrisjenx @Damilola Akinterinwa I'll take your advice into account. I'm struggling with the starting point. I think it will be complicated
c
yeah, not going to lie it's not a simple task, I would deffo use the output of the template creators. theres an kotlin one I think
p
You can use different Gradle modules which depend on a common abstraction module. Then each one implements these abstractions differently. You then decide which module to pick at build time, when you build one App or the other