Stan Ostrovskiy
1 min readMay 22, 2017

--

Yes, that’s exactly the way I am creating the cells: using another cell protocol, that holds more shared properties, such as cellFirstResponder, etc. So in the viewModel I can have a property:

var cell: ViewModelCell { get }

And in the dataModelItem it will look this way:

class ModelItem1 {
var cell: ViewModelCell {
return MyCustomCell1
}
}

In ViewController base class I dequeue the reusable cells for each item type.

But this approach still doesn’t make a complete separation between the View and ViewModel, since you are still configuring the cell with viewModel data inside the cellForRow method.

--

--

Stan Ostrovskiy
Stan Ostrovskiy

No responses yet