Renderer

fun interface Renderer<out TState, in TModel : Any>

Interface for transforming the current Loop model into a new view state.

For example:

class ScoreScreenRenderer : Renderer<ScoreScreenState, ScoreScreenModel> {
fun renderState(model: ScoreScreenModel) = ScoreScreenState(
playerName = model.user.nickname,
score = model.score.roundToInt().toString(),
)
}

Parameters

TState

the concrete type of the resulting state

TModel

the type of the Loop model

Functions

Link copied to clipboard
abstract fun renderState(model: TModel): TState