- Here I have covered the how viewmodels are managed in compose.
- Viewmodels that are linked to every screen.
- For achieving this, NavBackStackEntry is used as a lifecycle owner.
- Composable functions that are used to define screens have viewmodel scoped to them.
- ViewModel will remain in memory till the screen is visible.
- Along with that, added Scaffold, TopAppBar in Compose. This follows the material design layout structure in an android app.
- setup navigation framework using Jetpack Compose Composable Functions.
- Android Studio
- Add required dependencies for Hilt, viewModel, Retrofit, Navigation
- Also check Compose Compiler Version & its Compatible Kotlin Version.Ref: https://developer.android.com/jetpack/androidx/releases/compose-kotlin