I'm learning Koin's Scope from https://github.com/InsertKoinIO/koin/blob/master/koin-projects/docs/reference/koin-android/scope.md
If I have a Koin module as below
val myModule =
module {
scope<MyActivity> { scoped { Presenter() } }
}
In my activity, I could do this
class MyActivity : AppCompatActivity() {
private val presenter by lazy {
lifecycleScope.get<Presenter>(Presenter::class.java)
}
// ...
}
Or I could use this.scope
where this
is MyActivity
object.
class MyActivity : AppCompatActivity() {
private val presenter by lazy {
this.scope.get<Presenter>(Presenter::class.java)
}
// ...
}
I tested they are the same. Are both the same, or different? If they are different, what are their differences?