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(qualifier: Qualifier? = null, from: ViewModelStoreOwnerDefinition = { activity as ViewModelStoreOwner }, parameters: ParametersDefinition? = null): T
fun <T : ViewModel> Fragment.getSharedViewModel(clazz: KClass<T>, qualifier: Qualifier? = null, from: ViewModelStoreOwnerDefinition = { activity as ViewModelStoreOwner }, parameters: ParametersDefinition? = null): T

Get a shared viewModel instance from underlying Activity

sharedViewModel

fun <T : ViewModel> Fragment.sharedViewModel(qualifier: Qualifier? = null, from: ViewModelStoreOwnerDefinition = { activity as ViewModelStoreOwner }, parameters: ParametersDefinition? = null): Lazy<T>
fun <T : ViewModel> Fragment.sharedViewModel(clazz: KClass<T>, qualifier: Qualifier? = null, from: ViewModelStoreOwnerDefinition = { activity as ViewModelStoreOwner }, parameters: ParametersDefinition? = null): Lazy<T>

Lazy getByClass a viewModel instance shared with Activity