📖Lexicon

There are 3 main generic types used in Yamvil

UiState

UiState is straight forward and represents the persistent UI state of your Fragment or Composable Screen. It could be a data class, a sealed class or even better, a sealed interface.

The ViewModel is the class that updates values inside your UiState class, and the Fragment observe this state.

UiEvent

UiEvent is a type for representing something in the Screen that the fragment needs to know about. It could be a data class, a sealed class or even better, a sealed interface.

The fragment will call viewModel.handleEvent() with an instance (or object) of this type.

UiAction

UiAction is a type for representing one-off actions the ViewModel wants the Fragment to react to only once. As before, it could be a data class, a sealed class or even better, a sealed interface.

To use this, your UiState class should implement the Actionable interface and call state.onAction {} where the UI state is observed.

Last updated