Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aimalygin/StableCollectionViewLayout

UICollectionViewLayout adjusts a content offset if the collection view is updated
https://github.com/aimalygin/StableCollectionViewLayout

carthage cocoapods contentoffset ios spm swift uicollectionview uicollectionviewlayout uikit

Last synced: 6 days ago
JSON representation

UICollectionViewLayout adjusts a content offset if the collection view is updated

Awesome Lists containing this project

README

        



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](https://raw.githubusercontent.com/aimalygin/InfiniteCollectionViewFlowLayout/main/stable.gif)

## Demo

![Demo](https://raw.githubusercontent.com/aimalygin/InfiniteCollectionViewFlowLayout/main/demo.gif)

## Usage

You should just create and pass `StableCollectionViewFlowLayout` to `UICollectionView` init
```swift
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](https://cocoapods.org). Add the following to your `Podfile`:

```ruby
pod 'StableCollectionViewLayout', '~> 1.0.2'
```

### Carthage

For [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:

```ogdl
github "aimalygin/StableCollectionViewLayout" ~> 1.0.2
```

### Swift Package Manager

For [Swift Package Manager](https://swift.org/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.
```