I have an array of items (each corresponds to a cell data) and I want to create an array of cell ViewModels.
When I try to map the item to MutablePropery, I get Binary operator '<~' cannot be applied to operands of type 'MutableProperty<[CellViewModel]>' and '[CellViewModel]'
How should I change the below code in order to get reactive stream?
class ListViewModel {
var poiData = MutableProperty([CellViewModel]())
init(poiWrapper: PoiWrapper) {
self.poiData <~ poiWrapper.poiList.map({ (poiItem) in
return CellViewModel(poi: poiItem)
})
}
}
My Intention is to create a structure like the one below: From MVVM + ReactiveCocoa. The code I shared is ViewModel of my ViewController, where I tried to create cell ViewModels as soon as initiate my Parent ViewModel.