The extensions declared in this artifact simplify ViewModel injection with Katana.
Create a ViewModel binding inside a module:
data class MyViewModel(val someDependency: SomeDependency) : ViewModel()
createModule {
viewModel { MyViewModel(get()) }
}
Inject ViewModel in your Activity
or Fragment
:
class MyFragment : Fragment(),
KatanaTrait {
override val component: Component by lazy { ... }
private val viewModel by viewModel<MyViewModel>()
}