How to create components in commonMain for a Compose Multiplatform Project? #455
Unanswered
ksharma-xyz
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You check out https://github.com/evant/kotlin-inject/blob/main/docs/multiplatform.md? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been stuck trying to use kotlin-inject library therefore asking for help and I really wanna use this over koin because of compile time resolving. Therefore appreciate any help / directions and also I might just be asking some stupid questions which are covered in docs but I'm not able to get my head around it, so explaining my use case for better understanding.
Version:
ksp = "2.0.21-1.0.27"
kotlin = "2.0.21"
kotlinInject = "0.7.2"
Use case
:network -> using ktor to define http client, need to create a singleton HttpClient object scoped to the Application lifecycle.
:database -> has interface and internal implementation, will store data in db. Need to scope this to Application Lifecycle.
:ui -> Has ViewModels and calls Repository from network module. Need to scope ViewModel to the scope of Screen level composable.
All the code is in
commonMain
and none of it hasiosMain
/andoridMain
implementation as of now - Will this be a problem ?NetworkComponent
for ViewModel I have something like this:
Problems I'm facing:
create
method is not getting generated for these components e.g.ViewModelComponent::class.create()
Beta Was this translation helpful? Give feedback.
All reactions