xxfast
07/03/2021, 2:20 AMimport Foundation
class ViewModelDelegate : ObservableObject {
@Published var state: State = ViewModelsKt.DEFAULT_STATE
@Published var command: Command? = nil
init() {
subscribe(viewModel: ModuleKt.viewModel)
}
func subscribe(viewModel: ViewModel) {
viewModel.onChange { (state) in
self.state = state
}
}
}
is it possible to use Combine’s @Published
from kotlin side and get rid of this delegate all together?russhwolf
07/03/2021, 2:49 AM