-
Notifications
You must be signed in to change notification settings - Fork 38
Description
One thing I'd love to see is the ability to return cells in data source methods, in addition to UIImages, which are immutable and cannot update themselves. This would allow us to abstract logic about the content of each item out of the sidebar view and into the cell.
For example, a common idiom is to set a model property on a cell, which then sets up observers on the model's properties and updates the cell's subviews as appropriate when they change. The model object can asynchronously perform network or image processing operations, change it's image property to reflect these changes, then the cell can update the image independent of the sidebar view.
This is in contrast to putting all of this logic inside the sidebar view, then reloading the entire sidebar when the contents of an image changes.
To make this as simple as possible out of the box (and retain compatibility with existing code), you could check to see if the image variant of the data source method is implemented, create an image-only cell subclass behind the scenes and use it to populate the sidebar. Only users that needed cell functionality would implement the cell specific datasource method.