Home

Awesome

Swinflate

Carthage Compatible License Swift 4.2 Platform

<p align="center"><img src="https://github.com/VladIacobIonut/Swinflate/blob/master/ReadmeResources/logo.png"/></p>

Description

Swinflate aims to encorporate a set of collection view layouts which provide a better and even more fluid experience in collection vieews . It is amongst the goals of this project to make it ruthlessly simple for you to use it in your application.

Available layouts

SWInflateLayout

<p align="center"><img src="https://github.com/VladIacobIonut/Swinflate/blob/master/ReadmeResources/inflategif.gif" height="350" width="250"/></p>

SWHorizontalStackLayout

<p align="center"><img src="https://github.com/VladIacobIonut/Swinflate/blob/master/ReadmeResources/stackgif.gif" height="350" width="250"/></p>

Requirements

Installation

Swinflate is available for installation via Swift Package Manager and Carthage.

<br> To install via Carthage, paste the next line your Cartfile:
github "https://github.com/VladIacobIonut/Swinflate" ~> 1.0.3

Usage

This layouts are designed to work with horizontal collection view of a single row and multiple columns.

  1. Before using it, please import it in the class where your collectionView lies.
  import Swinflate
  1. To implement it, just pass an instance of one of the layout classes enumerated above to the constructor of the collectionView.
SWInflateLayout
  collectionView = UICollectionView(frame: .zero, collectionViewLayout: SWInflateLayout())
SWHorizontalStackLayout
let stackLayout = SWHorizontalStackLayout()
stackLayout.hasStackEffect = true
collectionView = UICollectionView(frame: .zero, collectionViewLayout: stackLayout)

Note

  1. You should also return the item size for your cells in the sizeForItem method of the UICollectionViewDelegateFlowLayout .
extension CustomLayoutViewController: UICollectionViewDelegateFlowLayout {
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return CGSize(width: cellWidth, height: cellHeight)
        }
    }