I'm using Koin 3.2 which has the new module includes feature. I am want to know what is the difference between the use of by inject()
or by viewmodel()
.
val viewModel by inject<MainActivityViewModel>()
or
val viewModel by viewmodel<MainActivityViewModel>()
in viewmodel. I know both works correctly.
Thanks
The difference is by viewmodel
will hook to register the instance to your Lifecycle. Where a simple by inject
just create the instance