KSYCollectionViewLayout 1.2

KSYCollectionViewLayout 1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by ‘huangdaxia’.



  • By
  • huangdaxia

KSYCollectionViewLayout

🚀 A waterfall flows collection view layout.

Results the preview

demo preview

How to use

  • init
  let layout = KSYCollectionViewLayout()
  layout.delegate = self
  • collection view use layout
  let collect = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
  • impl KSYCollectionViewLayoutDelegate
extension ViewController: KSYCollectionViewLayoutDelegate {
    func numberOfColumn(in collectionView: UICollectionView) -> Int {
        return columnCount
    }
    
    func collectionView(_ collectionView: UICollectionView, layout: KSYCollectionViewLayout, heightForItemAt indexPath: IndexPath) -> CGFloat {
        let height = 200 + arc4random() % 100
        
        return CGFloat(height)
    }
}