--

There shouldn't be any issues in having just one state, because both JetpackCompose and SwiftUI are very well optimized for detecting changes.

You can nest the state information of each screen inside the overall state. For example, you can have data classes for each screen, which are just properties of the overall state.

The AppState is simply retained by the StateFlow. You don’t need to use onSavedInstanceState. Everything really works out very clean. Your single source of truth is the AppState hold by the StateFlow.

--

--

Daniele Baroncelli
Daniele Baroncelli

Written by Daniele Baroncelli

Mobile architect (client/server), with over 15 years experience. Focusing on Android, iOS, Kotlin, Golang, Compose, SwiftUI, KMP, MVI.

Responses (1)