Introduction
ComposableDataSource wraps the typically verbose UICollectionView data source and delegate implementation into a more neatly packed builder pattern
Latest Version
0.7.45
Chain your UICollectionView delegate calls one after another as needed:
let dataSource = ComposableCollectionDataSource(....)
// chain selection delegate function
// chain cell size delegate function
// ... and so on ...Slim down your UIViewController
Often, your ViewController becomes bloated with handling when implementing UICollectionViewDelegate,
UICollectionViewDataSource and UICollectionViewDelegateFlowLayout,
etc. Tasks such as configuring dequeued cells, handling cell selection events, providing cell sizing, etc.
can require a lot of tedious code.
// The default way of implementing UICollectionViews
class ViewController: UIViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
numberOfItems...
cellForItem...
sizeForItem...
didSelectItem...
// ... Hundreds of more lines...
}
Prerequisites
- Xcode 8.0 or higher
- iOS 10.0 or higher
Installation
ComposableDataSource is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ComposableDataSource'