SquareFlowLayout
SquareFlowLayout is another UICollectionViewLayout subclass that implements Instagram style layout.
Makes your UICollectionView to looks like Instagram explore has never been so easy before. SquareFlowLayout provide dynamic layout generation by defining which IndexPath should be expanded.
Installation
CocoaPods
pod 'SquareFlowLayout'
Manually
- Download and drop
Classes
folder into your project. - Congratulations!
Usage
- Set
SquareFlowLayout
to your UICollectionView and set itflowDelegate
let flowLayout = SquareFlowLayout()
flowLayout.flowDelegate = self
self.collectionView.collectionViewLayout = flowLayout
- Make your class conform to
SquareFlowLayoutDelegate
- Use delegate method to decide which cell should be pinned
extension ViewController: SquareFlowLayoutDelegate {
func shouldExpandItem(at indexPath: IndexPath) -> Bool {
return self.layoutValues[indexPath.row] == .expanded
}
}
- Look into example project for more info