# multiplatform

Thomas Skovsgaard

08/17/2020, 5:52 AM
Hi, I'm trying to use swiftUI and KMP together, my viewmodels are shared between android and iOS, but I can't seem to figure out how to respond to changes in swiftUI, when my viewmodel is using StateFlow. Has anyone had any luck with that ?
👀 1


08/17/2020, 2:56 PM
How are you doing it on the android side and whats the block stopping you from using a similar process on the IOS side? Is it not possible to have a change in the UI trigger a function call?
☝️ 1

Thomas Skovsgaard

08/18/2020, 5:54 AM
It is the other way around, responding to model changes in the UI, normal in SwiftUI the viewModel would be Observable, so when something changes in the model the UI gets updated, but since the model is in the common part and shared, I'm not able to use Observable directly. I created an interface passing the values between my shared viewmodel and my SwiftUI file, but haven't figured out how to send updates from shared to interface. I found an example of something similar