As far as I can tell when using Jetpack Compose with Hilt there are two ways of creating/accessing a viewModel instance; viewModel() and hiltViewModel(). I can't understand which should be used as they seem to do the same thing. The documentation for viewModel() suggests that it automatically uses the View Model that Hilt constructs with @HiltViewModel. So what exactly is the difference between these two implementations and when should each be used?
© 2022 - 2024 — McMap. All rights reserved.