subscribe

inline fun <S : MVIState, I : MVIIntent, A : MVIAction> Fragment.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. Call this in Fragment.onViewCreated

Parameters

consume

called on each new action. Implement action handling here.

render

called each time the state changes. Render state here.

lifecycleState

the minimum lifecycle state the LifecycleOwner must be in to receive updates.

See also


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

Subscribe to the store lifecycle-aware. Call this in Fragment.onViewCreated.

Parameters

render

called each time the state changes. Render state here.

lifecycleState

the minimum lifecycle state the LifecycleOwner must be in to receive updates.

See also


fun <S : MVIState, I : MVIIntent, A : MVIAction, T : Fragment, StateConsumer<S>, ActionConsumer<A>, Consumer<S, I, A>> T.subscribe(lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job

Subscribe to the store lifecycle-aware. Call this in Fragment.onViewCreated

Parameters

lifecycleState

the minimum lifecycle state the LifecycleOwner must be in to receive updates.

See also


fun <S : MVIState, I : MVIIntent, A : MVIAction, T : LifecycleOwner, Consumer<S, I, A>> T.subscribe(lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job
@JvmName(name = "subscribeAndConsume")
fun <S : MVIState, I : MVIIntent, A : MVIAction, T : LifecycleOwner, Consumer<S, I, A>, ActionConsumer<A>> T.subscribe(lifecycleState: Lifecycle.State = Lifecycle.State.STARTED): Job

Subscribe to the store lifecycle-aware.

Parameters

lifecycleState

the minimum lifecycle state the LifecycleOwner must be in to receive updates.

See also