Skip to content

UICollectionViewLayout adjusts a content offset if the collection view is updated

License

Notifications You must be signed in to change notification settings

aimalygin/StableCollectionViewLayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b415081 · Nov 29, 2023

History

34 Commits
Nov 29, 2023
May 18, 2022
May 18, 2022
May 18, 2022
May 18, 2022
Sep 7, 2021
May 18, 2022
May 18, 2022
Oct 18, 2021
Mar 6, 2023
Apr 7, 2021
Mar 30, 2023
May 18, 2022
May 18, 2022
Apr 7, 2021
Oct 9, 2021

Repository files navigation

Build Status Pods Version Platforms SPM Compatible


StableCollectionViewLayout

This layout adjusts a content offset if the collection view is updated. You can insert, delete or reload items and StableCollectionViewLayout will take care of the content offset.

Like this

stable

Demo

Demo

Usage

You should just create and pass StableCollectionViewFlowLayout to UICollectionView init

import StableCollectionViewLayout

UICollectionView(frame: .zero, collectionViewLayout: StableCollectionViewFlowLayout())

Also, you can create the own subclass of StableCollectionViewLayout and use it.

Installation

CocoaPods

The preferred installation method is with CocoaPods. Add the following to your Podfile:

pod 'StableCollectionViewLayout', '~> 1.0.2'

Carthage

For Carthage, add the following to your Cartfile:

github "aimalygin/StableCollectionViewLayout" ~> 1.0.2

Swift Package Manager

For Swift Package Manager:

To integrate using Xcode:

File -> Swift Packages -> Add Package Dependency

Enter package URL: https://github.com/aimalygin/StableCollectionViewLayout, and select the latest release.