koin-android-viewmodel / org.koin.android.viewmodel.ext.android / android.support.v4.app.Fragment

Extensions for android.support.v4.app.Fragment

getSharedViewModel

fun <T : ViewModel> Fragment.getSharedViewModel(key: String? = null, name: String? = null, from: ViewModelStoreOwnerDefinition = { activity!! as ViewModelStoreOwner }, parameters: ParameterDefinition = emptyParameterDefinition()): T

Get a shared viewModel instance from underlying Activity

sharedViewModel

fun <T : ViewModel> Fragment.sharedViewModel(key: String? = null, name: String? = null, from: ViewModelStoreOwnerDefinition = { activity!! as ViewModelStoreOwner }, parameters: ParameterDefinition = emptyParameterDefinition()): Lazy<T>

Lazy getByClass a viewModel instance shared with Activity