--

First of all, the data we display on the Declarative UIs would come directly from the AppState.

Even though both JetpackCompose and SwiftUI provide ways to save/remember data inside the UI components, we want to avoid that as much as possible, as any extra structure we create on the UI layer needs to be replicated across all platforms. We aim for the UI layers to be stateless. There might be some situations where it makes sense to keep some state also on the UI, but those would be very limited.

We want our single source of truth to be the AppState.

In the use case you are presenting, where you have a list of items you want to process (e.g. filter, map, sort), you would keep that list (unprocessed) in the Data Repository. You would then save into the AppState only the processed version you want to display.

--

--

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.

No responses yet