Package-level declarations

Types

Link copied to clipboard
abstract class StateViewModel<State>(stateHolder: StateHolder<State>) : ViewModel, StateOwner<State>

Functions

Link copied to clipboard
fun <State> Fragment.collectState(stateOwner: StateOwner<State>, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED, block: (State) -> Unit): Job

Collect emissions from a StateHolder launched and scoped to Fragment.getViewLifecycleOwner.

fun <State> FragmentActivity.collectState(stateOwner: StateOwner<State>, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED, block: (State) -> Unit): Job

Collect emissions from a StateHolder launched and scoped to FragmentActivity lifecycle.

fun <State> StateOwner<State>.collectState(lifecycleOwner: LifecycleOwner, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED, block: (State) -> Unit): Job

Collect emissions from a StateHolder launched and scoped to the lifecycleOwner.

fun <State, T> Fragment.collectState(stateOwner: StateOwner<State>, selector: (State) -> T, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED, block: (T) -> Unit): Job

Collect emissions of a selected property of State scoped to Fragment.getViewLifecycleOwner.

fun <State, T> FragmentActivity.collectState(stateOwner: StateOwner<State>, selector: (State) -> T, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED, block: (T) -> Unit): Job

Collect emissions of a selected property of State scoped to FragmentActivity lifecycle.

fun <State, T> StateOwner<State>.collectState(lifecycleOwner: LifecycleOwner, selector: (State) -> T, lifecycleState: Lifecycle.State = Lifecycle.State.STARTED, block: (T) -> Unit): Job

Collect emissions of a selected property of State.