GWCollectionViewFloatCellLayout 1.0.1

GWCollectionViewFloatCellLayout 1.0.1

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

Maintained by gewill.




GWCollectionViewFloatCellLayout

Summary

Custom layout for a collection view using vertical scrolling with float cell, like UICollectionViewFlowLayout. Written in Swift.

Screenshot

screencast

Requirements

Swift 3.0, iOS 8.0

Use

Just set layout properties when viewDidLoad

import GWCollectionViewFloatCellLayout
    override func viewDidLoad() {
        super.viewDidLoad()

        let sectionWidth = UIScreen.main.bounds.width
        self.layout.floatItemSize = CGSize(width: sectionWidth, height: 20)
        self.layout.itemSize = CGSize(width: sectionWidth / 6, height: 40)
        self.layout.headerReferenceSize = CGSize(width: sectionWidth, height: 50)
        self.layout.footerReferenceSize = CGSize(width: sectionWidth, height: 50)

        self.layout.sectionInset = UIEdgeInsets(top: 10, left: 20, bottom: 30, right: 40)
        self.layout.minimumLineSpacing = 2
        self.layout.minimumInteritemSpacing = 4
    }

Installation

Feel free to drag GWCollectionViewFloatCellLayout.swift to your iOS Project. But it’s recommended to use Carthage (or CocoaPods).

Thanks

Thanks to  Brightec blog & Demo

Contact

Follow and contact me on Twitter or Sina Weibo. If you find an issue, just open a ticket on it. Pull requests are warmly welcome as well.

License

GWCollectionViewFloatCellLayout is available under the MIT License