Adam Brown
01/09/2023, 11:14 PMArkadii Ivanov
01/10/2023, 10:25 AMAdam Brown
01/10/2023, 5:48 PMConfig
and returns one of these "Destination" classes, these classes are what contain the actual Component
Adam Brown
01/10/2023, 5:49 PMchildFactory
just return a ComponentArkadii Ivanov
01/10/2023, 5:54 PMsealed class Child
:
1. CIf your If your navigation may contain different child components, then this approach allows you to switch children exhaustively and safely.
2. You are able to supply additional data, which is not the child's concern and is used at the parent's level (e.g. in the @Composable fun someParentContent(component: SomeParent) {}
function).
Feel free to omit it if you are fine with casting, or if you only have one possible child class.Adam Brown
01/10/2023, 5:55 PMAdam Brown
01/10/2023, 5:58 PMArkadii Ivanov
01/10/2023, 6:02 PMtypealias ComponentContent = @Composable (Modifier) -> Unit
interface MyComponent {
val stack: ChildStack<*, ComponentContent>
}
But they both may impact testability. All that so-called "boilerplate" makes testing with Decompose pretty straightforward.Adam Brown
01/10/2023, 6:02 PMAdam Brown
01/10/2023, 6:02 PMAdam Brown
01/10/2023, 6:03 PMArkadii Ivanov
01/10/2023, 6:14 PMAdam Brown
01/10/2023, 6:15 PM