https://github.com/cosmo/feedcollectionviewlayout
[WIP] 📱📐 Customizable UICollectionLayout for single and multi-column feeds.
https://github.com/cosmo/feedcollectionviewlayout
Last synced: 11 months ago
JSON representation
[WIP] 📱📐 Customizable UICollectionLayout for single and multi-column feeds.
- Host: GitHub
- URL: https://github.com/cosmo/feedcollectionviewlayout
- Owner: Cosmo
- Created: 2016-12-12T06:41:58.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-12T07:40:08.000Z (about 9 years ago)
- Last Synced: 2025-04-02T05:47:01.133Z (11 months ago)
- Language: Swift
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [WIP] FeedCollectionViewLayout
A Customizable UICollectionLayout for single and multi-column feeds.
## Usage
### Basic Setup
```swift
let collectionViewLayout = FeedCollectionViewLayout()
// setup optional properties here
return UICollectionView(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
```
### Enable Self-Sizing Cells (optional)
```swift
collectionViewLayout.estimatedItemHeight = 20.0
collectionViewLayout.itemHeight = FeedCollectionViewLayoutAutomaticHeight
```
### Properties
```swift
collectionViewLayout.itemHeight // CGFloat
collectionViewLayout.estimatedItemHeight // CGFloat
collectionViewLayout.sectionInsets // UIEdgeInsets
collectionViewLayout.numberOfColumns // Int
collectionViewLayout.lineSpacing // CGFloat
collectionViewLayout.interItemSpacing // CGFloat
```
### Delegate (optional)
Subclass `FeedCollectionViewLayoutDelegate` and implement the protocol:
```swift
func insetsForSection(_ section: Int) -> UIEdgeInsets
func lineSpacingForSection(_ section: Int) -> CGFloat
func interItemSpacingForSection(_ section: Int) -> CGFloat
func heightForItem(at indexPath: IndexPath) -> CGFloat
func numberOfColumns(inSection section: Int) -> Int
```
and create a reference:
```swift
collectionViewLayout.delegate = MyFeedDelegate()
```