Repository navigation
|
Hello Arkadii, We are adapting Decompose at our fintech project on Android. We have classic scenarios:
I checked an example https://github.com/arkivanov/decompose-dagger-sample Educational case:
Does it mean that for each ParentComponent, I will need to provide FeatureAComponentProvider, FeatureAComposableProvider (to hide implementation details of the feature) Don't you mind to share some ideas how to approach such architecture? |
Replies: 1 comment
|
The decompose-dagger-sample example doesn't follow the api/impl structure. In that example, both If you want to follow the api/impl structure, then unfortunately, Composable top-level functions can't have a separate API module. You'd need a workaround for it. From the top of my head, there are two options, each with their own pros and cons:
interface FeatureAComponent {
val state: StateFlow<FeatureAState>
@Composable
fun Content()
}Pros: feature impl modules only depend on child api modules and do not depend on child impl modules.
interface FeatureAComponent {
val state: StateFlow<FeatureAState>
}
fun interface FeatureAContent {
@Composable
operator fun invoke()
}Pros: component interfaces and classes do not depend on Compose. |
The decompose-dagger-sample example doesn't follow the api/impl structure. In that example, both
feature-rootandapp-androidcan see all feature component interfaces, implementation classes and Composable functions.If you want to follow the api/impl structure, then unfortunately, Composable top-level functions can't have a separate API module. You'd need a workaround for it. From the top of my head, there are two options, each with their own pros and cons:
Pros: feature impl modules only depend on child api modules and do …