Skip to content

//reactivestate/com.ensody.reactivestate.android/buildOnViewModel

buildOnViewModel

[android]\ inline fun <T : Any> Fragment.buildOnViewModel(crossinline provider: BuildOnViewModelContext.() -> T): Lazy<T>

Creates an object living on a wrapper ViewModel. This allows for building multiplatform ViewModels.

The provider should instantiate the object directly.

See also

reactiveState if you want to instantiate a multiplatform ReactiveState ViewModel directly.

[android]\ inline fun <T : Any> ComponentActivity.buildOnViewModel(crossinline provider: BuildOnViewModelContext.() -> T): Lazy<T>

Creates an object living on a wrapper ViewModel. This allows for building multiplatform ViewModels.

The provider should instantiate the object directly.

See also

reactiveState if you want to instantiate a multiplatform ReactiveState ViewModel directly.

[android]\ fun <T : Any> Lazy<WrapperViewModel>.buildOnViewModel(klass: KClass<T>, caster: (Any?) -> T?, provider: BuildOnViewModelContext.() -> T): Lazy<T>

Used internally by buildOnViewModel.