Finite State Machine as a ViewModel for Jetpack Compose Screens

Sergey Nes
Level Up Coding
Published in
11 min readAug 4, 2021

--

In this article, I will explicitly define a practical, step-by-step guide to model complex UI Screens using the Finite State Machine. I will also demonstrate how to implement FSM in Kotlin and Jetpack Compose, although the techniques described in this article are easily transferable to any other language or framework.

Understanding the Problem

As we already know, the Jetpack Compose framework works in three phases: composition, measurement, and rendering. To build an interactive…

--

--