Compose
Tangle supports ViewModel "injection" in composables in a manner very similar to Hilt's
navigation/viewModel artifact. It will scope the ViewModel to the composable's NavBackStackEntry
.
The viewModels are still able to make use of automatic [SavedStateHandle injection][/savedStateHandle.md],
including arguments annotated with @TangleParam
.
@Composable
fun MyComposable(
navController: NavController,
viewModel: MyViewModel = tangleViewModel()
) {
// ...
}