All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.harmony.kotlin.application.ui.mvi.ViewState.kt Maven / Gradle / Ivy

package com.harmony.kotlin.application.ui.mvi

/**
 * Defines the current state of the View
 */
interface ViewState

/**
 * Returns state [R] from an initial state [T] using [block] lambda.
 * @throws IllegalStateException if the initial state is different than [T]
 */
inline fun  ViewState.update(block: (state: T) -> R): R {
  check(this is T) { "Unexpected state $this" }
  return block(this)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy