In my project I have a splash screen, when it is displayed, my app loading some startup data from server, after loading the data shows another screen. For splash screen I create a ViewModel, but it stays in memory all the time. How to destroy it correctly?
Thank you for help!
@HiltViewModel
class SplashViewModel @Inject constructor (private val repository: Repository) {
....
}
Run Code Online (Sandbox Code Playgroud)
@Composable
fun SplashScreen(vm: SplashViewModel) {
...
}
Run Code Online (Sandbox Code Playgroud)
@Composable
fun Navigate() {
val navController = rememberNavController()
NavHost(navController = …Run Code Online (Sandbox Code Playgroud)