Hello I'm looking for some guidance while migratin...
# koin
Hello I'm looking for some guidance while migrating koin v2 to v3. Also moving to kotlin 1.8.10 and want to integrate new features with compose
Copy code
Will be replaced by
Copy code
val koinVersion = "3.0.1"
And following cases to rework Properties -
properties(map<String, String>)
This has changed from accepting
Map<String, Any>
Map<String, String>
but saving property still takes
and there is
getProperty<T>(): T
. So is this just leftovers API's and it's discouraged to save other types than
or there this method has been renamed and I can't find it? I can solve it with extension function but I want to know if there is something existing.
Copy code
fun KoinApplication.anyProperties(values: Map<String, Any>): KoinApplication {
    return this
SharedViewModels How do I get sharedVm from Activity now? Used to be
val viewModel by lazy { getSharedViewModel<AnViewModel>(from = { requireActivity() }) }
Should it be now
private val viewModel by activityViewModels<AnViewModel>()
? I saw issue https://github.com/InsertKoinIO/koin/issues/785 that
is renamed to
but this is not available for fragment. BeenRegistry -
Got a singleton class in which I insatiate a
Copy code
val koinApplication = GlobalContext.get()
anViewModel = koinApplication.koin.getByClassName(AnManagerViewModel::class)

private inline fun <reified T> Koin.getByClassName(className : KClass<*>) : T? {
        val definition = this.rootScope.beanRegistry.getDefinition(className)
        if(definition != null){
            return this.get<T>(definition.qualifier)
        return null
How can I achieve it in koin v3? Can I get the definition by
getScope(ScopeDefinition.ROOT_SCOPE_ID)._scopeDefinition.definitions.find { it.qualifier?.value == className.qualifiedName }
? Thanks for help!
Hey will help you about that 👍 let me get some time to check all your topics
I would even encourage to go with latest 3.3.2 or 3.4.3 ... as you will have latest fixes & API updates. There were some API renamign to be conform to core Android API
this will solve consistency in properties API
`sharedViewModel`has been named to
To retrieve an instance with a given KClass, use:
Copy code
fun <T> get(
        clazz: KClass<*>,
        qualifier: Qualifier? = null,
        parameters: ParametersDefinition? = null
getScope(ScopeDefinition.ROOT_SCOPE_ID)._scopeDefinition.definitions.find { it.qualifier?.value == className.qualifiedName }
seems that you try to resolve a definition, with qualifier used in className
all from root
Really hard use of internals here 😕