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

Marc

09/15/2023, 9:45 AM
Hey I am looking at appyx (decompose is similar). Essentially it works as a tree of nodes which makes it useful to hace a scope per component. Wondering how to model this with koin. Is there a way to pass parameters to a scope? Each scope should inherit everything from above.
a

arnaud.giuliani

09/15/2023, 1:03 PM
In Koin we are taking relay on CompositionLocal to override local scope. This way child inherit from overriden scope
m

Marc

09/15/2023, 2:46 PM
This way child inherit from overriden scope
is this automatic or do i need to manually do linkTo?
a

arnaud.giuliani

09/15/2023, 5:00 PM
scope is propagated to all child - automatic
if in one child you need another scope, you override it at its level
m

Marc

09/15/2023, 5:01 PM
Awesome!
is there a way to pass a param to a scope? for example if i have an authenticated scope can i pass the user model somehow?
a

arnaud.giuliani

09/18/2023, 9:53 AM
you can add new object instance inside direct with
declare()
:
scope.declare(<your object>)
❤️ 1