Jacky
08/17/2023, 4:24 PMgetViewModel
. This, however, requires to create an instance of view-model - what If I have some dependencies in my view-model that should be injected (by Koin). Is this correct thinking of mine or it's not quite possible to have same UI and view-model for Android and iOS? Thanks.alex009
08/18/2023, 8:10 AMgetViewModel
from mvvm-compose
, but inside viewModelFactory
you can use koin to receive all required depsalex009
08/18/2023, 8:10 AMalex009
09/17/2023, 4:37 PMkoin
object (just call getKoin()
) then inside viewModelFactory
you can create viewmodel with koin.
viewModelFactory { koin.get<SomeViewModel>() }
Pablo Trescoli
09/24/2023, 4:58 PMviewModelFactory
will make sure the created viewModel is saved during configuration changes?
factory { SomeViewModel(injectParam = get()) }
and:
val koin = getKoin()
val viewModel = getViewModel(
key = screenKey,
factory = viewModelFactory { koin.get<SomeViewModel>() }
)
Thank you!