FlexibleCollectionView 0.1.2

FlexibleCollectionView 0.1.2

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

Maintained by Ryo Ishikawa.



  • By
  • Ryo Ishikawa

FlexibleCollectionView

Example

FlexibleCollectionView-left FlexibleCollectionView-right

Usage

Example of using in ViewController.

let layout = FlexibleCollectionViewLayout()

// The number of rows
layout.rows             = 4

// The space between items
layout.spacing          = 15

// Animation duration
layout.duration         = 0.4

layout.sectionInset     = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)

collectionView = FlexibleCollectionView(frame: UIScreen.main.bounds, layout: layout)

collectionView.delegate = self

collectionView.dataSource = self

collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "CELL")

view.addSubview(collectionView)

FlexibleCollectionViewLayout is inherited from UICollectionViewFlowLayout. and these properties are available.

Property name Description
rows The number of row
maximumRows The maximum row count
minimumRows The minimum row count
spacing The space between items
duration Animation duration
animationEnabled animation flag

FlexibleCollectionView can use the following delegate.

@objc public protocol FlexibleCollectionViewDelegate: UICollectionViewDelegate {

    @objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, willSwipeViewFor direction: UISwipeGestureRecognizerDirection)

    @objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, didSwipeViewFor direction: UISwipeGestureRecognizerDirection)

    @objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, didFinishAnimation: Bool)

}

Requirements

XCode8+

Swift3

Installation

pod "FlexibleCollectionView"

and

$ pod install

Author

Ryo Ishikawa, [email protected]

License

FlexibleCollectionView is available under the MIT license. See the LICENSE file for more info.