Package 

Class MVIComposableKt

    • Method Summary

      Modifier and Type Method Description
      final static <S extends MVIState, I extends MVIIntent, A extends MVIAction> Unit MVIComposable(Store<S, I, A> store, Lifecycle.State lifecycleState, Function2<ConsumerScope<I, A>, S, Unit> content) A function that introduces ConsumerScope to the content and ensures safe lifecycle-aware and efficient collection of states and actions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • MVIComposable

        @Composable() final static <S extends MVIState, I extends MVIIntent, A extends MVIAction> Unit MVIComposable(Store<S, I, A> store, Lifecycle.State lifecycleState, Function2<ConsumerScope<I, A>, S, Unit> content)

        A function that introduces ConsumerScope to the content and ensures safe lifecycle-aware and efficient collection of states and actions. Usage:

        @Composable
        fun HomeScreen() = MVIComposable(getViewModel<HomeViewModel>()) { // this: ConsumerScope<S, I, A>
            consume { action ->
                when(action) {
                    /*...*/
                    }
                }
                when(state) {
                    //use state to render content
                }
            }
        Parameters:
        lifecycleState - the minimum lifecycle state, in which the activity must be to receive actions/states
        content - the actual screen content.