Closed olegivo closed 1 year ago
That likely depends on your SwiftUI code.
It probably expects an ObservableObject
, which means you would need to use a KMMViewModel
type.
So I guess the best way would be to convert your ItemViewModel
to an abstract class. Allowing it to be a subclass of KMMViewModel
.
Note: in order for state changes to propagate to Swift you should use the KMMViewModel constructor for MutableStateFlow
:
override val title = MutableStateFlow(viewModelScope, "")
@rickclephas , thank you very much! This approach works ❤️
Interfaces are useful in case of faking in previews. For example:
And use them for previews:
What about SwiftUI?