Skip to content

Repository files navigation

SSAlignmentFlowLayout

📊 A lightweight, flexible UICollectionViewFlowLayout subclass for easily aligning cells per section with optional row limits.

SwiftPM compatibleSwiftPlatformLicense: MIT


Features

  • Configure a single alignment for all sections, or use closures for section-specific logic.
  • Optionally limit the number of rows per section.
  • Integrates seamlessly with Interface Builder or programmatically.

Usage

// 1. Single static alignment for all sections
collectionView.collectionViewLayout =SSAlignmentFlowLayout(alignment:.left)
// 2. Dynamic alignment & row limit via closures (safe of retain cycles)
collectionView.collectionViewLayout =SSAlignmentFlowLayout(
alignmentProvider:{[weak self] section inguardlet self else{return.left }returnself.alignment(for: section)},
limitOfRowsProvider:{ section in
section ==0?2:0})

Installation

SSAlignmentFlowLayout is available via Swift Package Manager.

Using Xcode:

  1. Open your project in Xcode
  2. Go to File > Add Packages…
  3. Enter the URL:
https://github.com/dSunny90/SSAlignmentFlowLayout
  1. Select the version and finish

Using Package.swift:

dependencies:[.package(url:"https://github.com/dSunny90/SSAlignmentFlowLayout", from:"1.0.0")]

About

A layout object that organizes items with specific alignment, fixed spacing.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages