Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/aimalygin/StableCollectionViewLayout
- Owner: aimalygin
- License: mit
- Created: 2021-04-07T11:59:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T06:06:52.000Z (about 1 year ago)
- Last Synced: 2024-04-24T18:58:02.893Z (8 months ago)
- Topics: carthage, cocoapods, contentoffset, ios, spm, swift, uicollectionview, uicollectionviewlayout, uikit
- Language: Swift
- Homepage:
- Size: 4.02 MB
- Stars: 63
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-ios - 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. (UI / Table View / Collection View)
- awesome-ios-star - 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. (UI / Table View / Collection View)
README
----------------
# 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 StableCollectionViewLayoutUICollectionView(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.
```