https://github.com/rubygarage/collection-view-layouts
A library that implements custom flow layouts for iOS apps
https://github.com/rubygarage/collection-view-layouts
500px collectionview collectionviewflowlayout facebook flickr flipboard instagram ios pinterest swift tags
Last synced: 4 months ago
JSON representation
A library that implements custom flow layouts for iOS apps
- Host: GitHub
- URL: https://github.com/rubygarage/collection-view-layouts
- Owner: rubygarage
- License: apache-2.0
- Created: 2018-03-30T08:32:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T19:07:13.000Z (about 5 years ago)
- Last Synced: 2025-05-24T00:08:15.000Z (4 months ago)
- Topics: 500px, collectionview, collectionviewflowlayout, facebook, flickr, flipboard, instagram, ios, pinterest, swift, tags
- Language: Swift
- Homepage:
- Size: 1.03 MB
- Stars: 685
- Watchers: 14
- Forks: 85
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/rubygarage/collection-view-layouts)
[](https://codecov.io/gh/rubygarage/collection-view-layouts)# About
Collection View Layouts is a set of custom layouts for iOS which imitate general data grid approaches for mobile apps.
# Layout types
Tags
500px
![]()
![]()
![]()
![]()
Flickr
![]()
![]()
![]()
## Overview
* 7 popular layouts for iOS collection view
* Tags and Flipboard layouts support left and right content align
* 500px has custom cells layout configuration
* Three modes for Instagram layout (default grid mode, one preview cell, regular preview cell)
* Each layout can be configured with content and cells paddings separately
* Tests coverage more than 90%## Installation
### CocoaPods
Collection View Layouts is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following lines (depends on your needs) to your `Podfile`:```ruby
pod 'collection-view-layouts/Core'
pod 'collection-view-layouts/TagsLayout'
pod 'collection-view-layouts/PinterestLayout'
pod 'collection-view-layouts/Px500Layout'
pod 'collection-view-layouts/InstagramLayout'
pod 'collection-view-layouts/FlipboardLayout'
pod 'collection-view-layouts/FacebookLayout'
pod 'collection-view-layouts/FlickrLayout'
```## Requirements
iOS: 11.0+
Swift: 5.0
CocoaPods: for iOS## Example
To run the example project, clone the repo, and run pod install from the Example directory first.## Usage
Configuration of custom layouts is pretty easy:
```swift
var layout: BaseLayout = TagsLayout()layout.delegate = self
layout.delegate = ItemsPadding(horizontal: 10, vertical: 10)
layout.cellsPadding = ItemsPadding(horizontal: 8, vertical: 8)collectionView.collectionViewLayout = layout
collectionView.reloadData()
```Also, you have to implement LayoutDelegate protocol:
```swift
public protocol LayoutDelegate: class {
func cellSize(indexPath: IndexPath) -> CGSize
}func cellSize(indexPath: IndexPath) -> CGSize {
return cellsSizes[indexPath.row]
}
```## Author
Sergey Afanasiev
## Getting Help
sergey.afanasiev@rubygarage.org
## License
Collection View Layouts is licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0)
***
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfuly employ other technologies to deliver the best results to our clients. [Check out our portoflio](https://rubygarage.org/portfolio) for even more exciting works!