https://kotlinlang.org logo
m

Mustafa Ozhan

11/01/2020, 12:38 PM
Is there any way to extend a kotlin class in common from
Combine > ObservedObject
so that we can use as
@ObservedObject
in SwiftUI views ? Or do we have to create a wrapper for each viewModel ?
j

John O'Reilly

11/01/2020, 1:03 PM
Just my 2c but I think in that case there's isn't a lot of value in having view models in shared code....what you might have though are what I think of as "view model helper" classes that are then used by "native" view model (based on ObservableObject on iOS and AAC ViewModel on Android)
☝️ 1
m

Mustafa Ozhan

11/01/2020, 1:31 PM
Thank you for you reply, yes i read this one, it is really interesting one and has many benefits, but I do not like the idea of creating view model in each platform for each screen. Because we can achieve viewModel for Android and JS in common probably it will be better to duplicate only on IOS side. On the other hand I am really wondering if I really need to use
Combine, ObservedObject
with
@ObservedObject
and
@Published
vars on IOS side or better to use straightforward approach like here: https://github.com/kuuuurt/jokes-app-multiplatform/blob/master/ios/JokesApp/ViewController.swift
👍🏻 1
s

saket

11/01/2020, 5:17 PM
m

Mustafa Ozhan

11/01/2020, 10:08 PM
this one was interesting too will try this also thanks a lot!
9 Views