How to use abstract class ViewModel with hiltViewM...
# android
k
How to use abstract class ViewModel with hiltViewModel?
😶 4
v
What exactly are you trying to achieve? If you want to have an abstract
ViewModel
you should use hilt to get an instance of your actual
ViewModel
who extends the abstract
ViewModel
. You can’t have object from an
abstract
class.
👌 1
k
Was able to achieve it with:
Copy code
val viewModel: Interface = hiltViewModel<InterfaceImpl>()