https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

Christian Gaisl

10/22/2023, 7:23 AM
Hi, I recently discovered Square's Workflow library. It's an evolution of the ViewModel concept that implements an action pipeline that keeps the state sane when processing multiple actions concurrently. Also, it adds props/inputs and outputs to workflows/ViewModels, making it possible to hoist state to a parent ViewModel. This makes workflows reusable, similar to how hoisting state out of Compoes Views makes them reusable. With that we can use workflows hierarchically in a parent-child hierarchy, making complex inter-screen interactions, like split screens or multi-screen sign-up flows possible. The library is built independent of the UI framework used, making it a prime candidate to write in a shared Kotlin Multiplatform module. Is there something like Workflow for Kotlin Multiplatform?
k

kevin.cianfarini

10/22/2023, 7:25 AM
I'd recommend implementing presenters/view models with compose state management instead. https://github.com/cashapp/molecule/
1
c

Christian Gaisl

10/22/2023, 7:34 AM
I'll take a look at it, thanks 👍
👍 1
c

Casey Brooks

10/22/2023, 1:00 PM
Ballast gives a more traditional MVI approach that may be more familiar than Molecule if you're comfortable with Workflow. It also has additional features like Navigation and an Intellij plugin to help with debugging your ViewModels (disclaimer, I'm the author) https://github.com/copper-leaf/ballast
r

russhwolf

10/22/2023, 4:22 PM
Workflow does have multiplatform support in the core and runtime modules.
c

Christian Gaisl

10/26/2023, 8:32 AM
@kevin.cianfarini I took a look at your suggestion and it made me write this article, thanks again 👍 https://medium.com/@cgaisl/beyond-mvvm-hierarchical-state-management-with-molecule-and-compose-660648eeb88e
10 Views