Package-level declarations

Types

Link copied to clipboard
open class StoreViewModel<S : MVIState, I : MVIIntent, A : MVIAction>(store: Store<S, I, A>, start: Boolean = true) : ViewModel, Store<S, I, A> , Container<S, I, A>

An extendable class for creating a ViewModel that directly uses a delegate to act as a Store. There are 2 possible ways to use this class:

Functions

Link copied to clipboard
@JvmName(name = "subscribeAndConsume")
fun <S : MVIState, I : MVIIntent, A : MVIAction, T : LifecycleOwner, StateConsumer<S>, ActionConsumer<A>> T.subscribe(provider: Store<S, I, A>, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job

Subscribe to the store lifecycle-aware.

fun <S : MVIState, I : MVIIntent, A : MVIAction, T : LifecycleOwner, StateConsumer<S>> T.subscribe(provider: Store<S, I, A>, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job

Subscribe to the store lifecycle-aware. This function will not collect the store's actions.

inline fun <S : MVIState, I : MVIIntent, A : MVIAction> LifecycleOwner.subscribe(store: Store<S, I, A>, crossinline render: suspend (state: S) -> Unit, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> LifecycleOwner.subscribe(store: Store<S, I, A>, noinline consume: suspend (action: A) -> Unit, crossinline render: suspend (state: S) -> Unit, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job

Subscribe to the store lifecycle-aware.