Skip to content

Easily create collection views with a desired number of columns

License

Notifications You must be signed in to change notification settings

ValentinDenis/CWCollectionView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CWCollectionView

Description

UICollectionView subclass to easily setup a collection view with a given number of columns. Just so you know, it uses swizzling for these two methods of UICollectionViewDelegate:

collectionView(_:layout:sizeForItemAt:)
collectionView(_:layout:insetForSectionAt:)

How to use

Just use CWCollectionView as a class for your collection view (from storyboard or code) Make your VC implement CWCollectionViewDelegate These methods need to be implemented:

func numberOfColumns() -> Int
func itemHeightRatio() -> CGFloat
func sectionInsets() -> UIEdgeInsets
func itemMinimumMargin() -> CGFloat
func headerHeight() -> CGSize

Then don't forget to set the cwDelegate property of your collectionView.

cwCollectionView.cwDelegate = self

Clone the repo to see an exemple project

Example

To run the example project, clone the repo, and run the xcodeproj

Requirements

CWCollectionView is compatible for iOS versions > 9.0 CWCollectionView is written in swift 4.1

Installation

Just add the the following line for your target:

pod 'CWCollectionView'

Then run

pod install

Author

![Cwep](http://static.750g.com/images/622-auto/d5ad3d69b82fb7b65b81313a45c80973/crepes-de-grand-mere.png =200x) Cwep, [email protected]

License

MIT

About

Easily create collection views with a desired number of columns

Resources

License

Stars

Watchers

Forks

Packages

No packages published