https://kotlinlang.org logo
#ios
Title
# ios
k

katokay

05/27/2020, 7:25 PM
I recently put together a sample that demonstrates a redux-like store using kotlin flows in a multi-platform project and rendering to SwiftUI views in a unidirectional data flow. It seems to be working great with one exception. State is updated as the flow collects / iterates but the UI never repaints until the flow completes. I'm suspecting it's in the single threaded nature of coroutines on iOS and that I need a newer build of coroutines native-mt. I'm making some assumptions there though. Curious if anyone has any ideas? Here is the project. https://github.com/CoreyKaylor/kotlin-mpp-flow-store
r

ribesg

05/28/2020, 11:17 AM
You’re using SwiftUI but in Swift, did you try using it in Kotlin? I’m working on a 100% Kotlin iOS app but right now I’m still building iOS views the old way, with just a small DSL I made to help
k

katokay

05/28/2020, 12:12 PM
No, you can't to my knowledge use swift only api's from kotlin. One simple example is that SwiftUI views are structs and currently there is no translation there. I think for me leaning on Swift only for the view with the SwiftUI api is a good compromise, it feels less like programming in swift and more like a view DSL.
I should also add that the live preview of SwiftUI views makes building out screens ridiculously easy and the feedback is very fast.
2 Views