Open piercifani opened 5 years ago
Do you mean something like...
protocol HasState: class {
associatedtype T
var state: ListState<T> { get set }
}
to apply as:
class CollectionViewStatefulDataSource<Cell: ViewModelReusable & UICollectionViewCell>: NSObject, UICollectionViewDataSource, HasState {
...
}
and also
class GIFCreateViewController: UIViewController, UITableViewDataSource, HasState {
...
}
Interesting: couple of questions:
GIFCreateViewController
or GIFDetailViewController
conform to this? HasState
protocol?And if we bring this protocol to UIViewController/UIView, maybe we need to rename ListState
to just State
, right?
And if we bring this protocol to UIViewController/UIView, maybe we need to rename
ListState
to justState
, right?
Sure. Just "State" would fit better in most scenarios...
The
loading
state and theerror
state ofListState
are also used on ViewControllers without a collectionView and it would be useful to add an abstraction that fixes both cases