Sample of usage VisualFSM for KMM (Android + iOS) application - Kotlin Coroutines, Jetpack Compose, SwiftUI
ENG | RUS
VisualFSM is a Kotlin library that implements an MVI architecture
(Model-View-Intent
)[1] and a set of tools for visualization and analysis of
FSM's (Finite-state machine
)[2] diagram of states.
The graph is being built from source code of FSM's implementation. There is no need of custom written configurations for FSM, you can just create new State and Action classes, they would be automatically added to the graph of States and Transitions.
Source code analysis and the graph built are being performed with reflection and declared as a separate module that would allow it to be connected to testing environment.
Feature: AuthFeature.kt
States: AuthFSMState.kt
Actions: actions
AsyncWorker: AuthFSMAsyncWorker.kt
States to Ui data models mapper: ScreenDataMapper.kt
Generate digraph and tests sample: AuthFSMTests.kt
For CI visualization use graphviz, for the local visualization (on your PC) use webgraphviz.
Login | Registration | ConfirmationRequested |
AsyncWorkState.Registering | Login with snackbar | UserAuthorized |
MVI
stands for Model-View-Intent. It is an architectural pattern that utilizes unidirectional
data flow. The data circulates between Model
and View
only in one direction - from Model
to View
and from View
to Model
.
A finite-state machine
(FSM) is an abstract machine that can be in exactly one of a finite number
of states at any given time. The FSM
can change from one state to another in response to some
inputs.