We should be able to unify our table- and collection-specific components into single, generic components using a similar approach to https://github.com/jessesquires/JSQDataSourcesKit.
The model in JSQDataSourcesKit and here are a bit different, but we should be able to do this. The main difference is that JSQDataSourcesKit does not consume the delegate properties — only the dataSource.
Todo (roughly):
- Unify
CollectionViewCellViewModel and TableViewCellViewModel --> CellViewModel<T>
- Unify
CollectionViewModel and TableViewModel --> CellParentViewModel<T>
- Unify the nested
SectionModels
- Unify
CollectionViewDataSource and TableViewDataSource --> DataSource<T>
Then, we can implement the UITableViewDataSource and UICollectionViewDataSource methods in constrained extensions on DataSource<T> similar to this:
https://github.com/jessesquires/JSQDataSourcesKit/blob/develop/Source/DataSourceProvider.swift#L64
We should be able to unify our table- and collection-specific components into single, generic components using a similar approach to https://github.com/jessesquires/JSQDataSourcesKit.
The model in
JSQDataSourcesKitand here are a bit different, but we should be able to do this. The main difference is thatJSQDataSourcesKitdoes not consume thedelegateproperties — only thedataSource.Todo (roughly):
CollectionViewCellViewModelandTableViewCellViewModel-->CellViewModel<T>CollectionViewModelandTableViewModel-->CellParentViewModel<T>SectionModelsCollectionViewDataSourceandTableViewDataSource-->DataSource<T>Then, we can implement the
UITableViewDataSourceandUICollectionViewDataSourcemethods in constrained extensions onDataSource<T>similar to this:https://github.com/jessesquires/JSQDataSourcesKit/blob/develop/Source/DataSourceProvider.swift#L64