/RLWaterfallFlowlayout

A waterfall flowlayout for CollectionView (Swift)

Primary LanguageSwift

RLWaterfallFlowlayout

Usage

  1. Init flowLayout and setup some params.
let waterFlowLayout = RLWaterfallFlowLayout()
waterFlowLayout.columnCount = 3
waterFlowLayout.sectionInset = UIEdgeInsets(top: 20, left: 10, bottom: 20, right: 10)
waterFlowLayout.columSpacing = 10
waterFlowLayout.rowSpacing = 10
waterFlowLayout.delegate = self

2.Make ViewController extends RLWaterfallFlowLayoutDelegate and implement delegate methods

func itemHeight(_ collectionView: UICollectionView?, indexPath: IndexPath) -> CGFloat {
    return itemHeight[indexPath.item]
}

3.ScreenShot