SkillAgentSearch skills...

SquareFlowLayout

🌄 UICollectionViewLayout subclass inspired by Instagram Discover page style layout.

Install / Use

/learn @ChernyshenkoTaras/SquareFlowLayout

README

SquareFlowLayout

Swift 4.2.x License PRs Welcome

<p><img src="https://github.com/ChernyshenkoTaras/SquareFlowLayout/blob/master/SquareFlowLayout/Screenshots/SquareFlowLayout-4.png" alt="Smiley face" align="right"> </p>

Makes your UICollectionView to looks like Instagram explore has never been so easy before. SquareFlowLayout provide dynamic layout generation by defining which IndexPath should be expanded.

Installation

CocoaPods

pod 'SquareFlowLayout'

Manually

  1. Download and drop Classes folder into your project.
  2. Congratulations!

Usage

  1. Set SquareFlowLayout to your UICollectionView and set it flowDelegate
    let flowLayout = SquareFlowLayout()
    flowLayout.flowDelegate = self
    self.collectionView.collectionViewLayout = flowLayout
  1. Make your class conform to SquareFlowLayoutDelegate
  2. Use delegate method to decide which cell should be pinned
extension ViewController: SquareFlowLayoutDelegate {
    func shouldExpandItem(at indexPath: IndexPath) -> Bool {
        return self.layoutValues[indexPath.row] == .expanded
    }
}
  1. Look into example project for more info
<p align="left"> <a href="https://imgflip.com/gif/2mxpdi"><img src="https://i.imgflip.com/2mxpdi.gif" title="made at imgflip.com"/></a> </p>

Contributing to this project

If you like this tool, show your support by tell me how do u use it.

License

This code is distributed under the terms and conditions of the MIT license.

Related Skills

View on GitHub
GitHub Stars159
CategoryDevelopment
Updated8mo ago
Forks23

Languages

Swift

Security Score

92/100

Audited on Jul 25, 2025

No findings