koin-android-architecture / org.koin.android.architecture.ext / android.arch.lifecycle.LifecycleOwner / getViewModel
getViewModel
inline fun <reified T : ViewModel> LifecycleOwner.getViewModel(key: String? = null, name: String? = null): T
Get a viewModel instance
Parameters
key -
- ViewModel Factory key (if have several instances from same ViewModel)
name -
- Koin BeanDefinition name (if have several ViewModel definition of the same type)
inline fun <reified T : ViewModel> LifecycleOwner.getViewModel(key: String? = null, name: String? = null, noinline parameters: Parameters): T
Get a viewModel instance
Parameters
key -
- ViewModel Factory key (if have several instances from same ViewModel)
name -
- Koin BeanDefinition name (if have several ViewModel definition of the same type)
parameters -
- parameters to pass to the BeanDefinition