Hilt integration
Add
@HiltViewModel
and @Inject
annotations to your ViewModel
.@HiltViewModel
class HomeViewModel @Inject constructor() : ViewModel() {
// ...
}
Call
getViewModel()
to get a new instance.class HomeScreen : AndroidScreen() {
@Composable
override fun Content() {
val screenModel = getViewModel<HomeScreenModel>()
// ...
}
}
Last modified 1yr ago