Package-level declarations

Types

Link copied to clipboard

No need to access this directly.

Functions

Link copied to clipboard

Adds a view model key to the arguments of the fragment. You can use it like this: childFragmentManager.beginTransaction() .add( fragmentContainerId, ChildFragment::class.java, Bundle().addViewModelKey(childViewModelKey), CHILD_FRAGMENT_TAG ) )

Link copied to clipboard
inline fun <VM : ViewModel> ComponentActivity.createViewModelScope(extraKey: String? = null, noinline extrasProducer: () -> CreationExtras? = null, noinline factoryProducer: () -> ViewModelProvider.Factory? = null): Lazy<VM>

inline fun <VM : ViewModel> Fragment.createViewModelScope(extraKey: String? = null, noinline extrasProducer: () -> CreationExtras? = null, noinline factoryProducer: () -> ViewModelProvider.Factory? = null): Lazy<VM>

Creates a ViewModel with the given owner (default is this@Fragment) and registers it.

Link copied to clipboard

You should not need to call this directly. It is called by scopedInterface and scopedViewModel. If you have added a key to the arguments of the fragment, it will use that key to retrieve the ViewModelStoreOwner. Otherwise it will use the default key.

Link copied to clipboard
inline fun <VM : ViewModel> putOwnerInRegistry(extraKey: String, owner: ViewModelStoreOwner)

You shouldn't need to call this directly.

Link copied to clipboard
fun <T> Lazy<T>.registerWith(lifecycleOwner: LifecycleOwner)
Link copied to clipboard

Provides an interface that has been registered via createViewModelScope by any parent of this Fragment. This will fail if no ViewModel implementing the Interface was registered.

Link copied to clipboard

Provides a ViewModel that has benn registered via createViewModelScope by any parent of this Fragment.

Properties

Link copied to clipboard
const val DEFAULT_KEY: String

You should not need to reference this directly.

Link copied to clipboard

You should not need to reference this directly.