https://kotlinlang.org logo
Title
a

Ayla

04/24/2023, 12:49 AM
Hi all, I would like to know if StateFlow is suitable for use in KMM. Since compose ios is still in alpha, and the integration of stateflow and SwiftUI in ios does not seem to be so easy, and the samples I have seen all use MVI/MVP to avoid this problem, does this mean that StateFlow is not suitable for KMM used as part of MVVM?
r

Rick Clephas

04/26/2023, 6:57 AM
Using StateFlows with SwiftUI indeed requires some boilerplate. I have worked on a solution that allows you to use your Kotlin ViewModels in SwiftUI: https://github.com/rickclephas/KMM-ViewModel