Closed OKatrych closed 1 year ago
Have you tried with the get()
function from Koin?
https://insert-koin.io/docs/reference/koin-android/get-instances/
I assume the one you mentioned koinInject()
tries to automatically manage the lifecycle of your view model through the composable. Since you're using resaca to handle the lifecycle of the view model, the Koin library doesn't need to take that responsibility anymore.
My bad, totally forgot that this can be retrieved from the activity.
No problem, I'm glad it worked 🙂
FYI: I have just added more documentation and examples on how to use resaca with Koin, plus a new extension library to support ViewModels with SavedStateHandle using Koin and resaca https://github.com/sebaslogen/resaca/blob/main/resacakoin/Readme.md
@sebaslogen this is 🥇. Thank you a lot 🙂.
When trying to use the
viewModelScoped
with Koin'skoinInject()
the compilation throws the error: "Composable calls are not allowed inside the builder". Please note thatkoinInject()
is a@Composable
function and it's usage is not allowed inside the non-composablenoinline builder: @DisallowComposableCalls () -> T
.Example: