is there anyway to access the SwiftUI framework from multiplatform code? i want my iOS viewmodel to extend
ObservableObject
but it seems like I may not be able to access SwiftUI since there are no obj-c bridging headers
edit: change compose to swiftui - too much android on my mind
t
Thomas Myrden
01/11/2021, 5:03 PM
No dice here. Since Combine is Swift only, you're not going to be able to do this.
w
william
01/11/2021, 5:04 PM
maybe i'll write some Swift code gen stuff to automatically wrap my shared viewmodels to help me here. not for today though. thanks @Thomas Myrden!
t
Thomas Myrden
01/11/2021, 5:04 PM
You should be able to pretty easily write some custom code to bridge a delegate pattern or similar to a pub sub pattern though. Create a protocol with an extension that does this for you or something along those lines.
No sweat, good luck!
William I thought about it a lot too, basically you have 2 options:
• Introduce useCases and implement viewmodels per target (https://www.marcogomiero.com/posts/2020/kmm-shared-app-architecture/)
• Keep everything as it is and only for IOS introduce ViewModelWrappers and extend from