https://kotlinlang.org logo
#koin
Title
k

kenkyee

06/05/2019, 8:33 PM
How do you scope a non-Android module to an activity in a different module? We used to do something like this in an Android gradle module: scope(named("SOMETHING")) { single{} etc } and then in the Java gradle module which has non-UI objects: scope(named("SOMETHING")) { single{} ... } and then in the activity, we'd use this bindNamedScope(named("SOMETHING")) in the onCreate() of the Activity: fun LifecycleOwner.bindNamedScope(qualifier: Qualifier) { val scope = getKoin().getOrCreateScope(getScopeId(), qualifier) bindScope(scope) } private fun LifecycleOwner.getScopeId() = toString()