uli
04/14/2021, 7:50 PMA with an abstract property (a) and a class B which overrides property a .
Now A lives in the K/N world and I want B to be @Published.
I suppose there is no way to express the @Published annotation in K/N so B must be written in Swift.
Now Swift does not know about abstract classes and thinks a was a stored property and complains:
Cannot override with a stored property 'counter'
Do you guys see any way to get a subclass of Kotlin cass A with @published property a ?russhwolf
04/14/2021, 8:34 PMB need to subclass A instead of just containing an A?uli
04/14/2021, 8:45 PMuli
04/14/2021, 8:56 PMclass ViewState: CounterViewState, ObservableObject {
@Published var counter = "Loading ..."
}
struct CounterView: View {
@StateObject var viewState: ViewState
var viewModel: CounterViewModel
init() {
let state = ViewState()
viewState = state // ##### Won't let me assign here
viewModel = CounterViewModel(viewState: state)
}
So I figured I need a single constructor, tried inheritance, moved state properties from state object right into the viewmodel and ran into the abstract property issue.Michal Klimczak
04/16/2021, 8:12 PM