Awesome Open Source
Awesome Open Source


This repository aims to provide a simple way of implementing an infinite collection view.
By infinite, we mean that as soon as a user reaches the boundary of the collection view content, the content will then loop back to the start in a circular manner.


Using InfiniteCollectionView

In order to use InfiniteCollectionView:

  1. Make it the custom subclass of a UICollectionView component in your storyboard.
  2. Set the infiniteDataSource (not the standard UICollectionView dataSource) and implement the required functions.


The custom datasource is very similar to the standard UICollectionViewDataSource. There are 3 functions to implement:

func cellForItemAtIndexPath(collectionView: UICollectionView, dequeueIndexPath: NSIndexPath, usableIndexPath: NSIndexPath) -> UICollectionViewCell

This function operates exactly the same as the regular cellForItemAtIndexPath, however, you should use dequeueIndexPath for dequeuing your cell and usableIndexPath for your content.

func numberOfItems(collectionView: UICollectionView) -> Int

As with the standard UICollectionViewDatasource, simply return the number of cells of content you have.

Current Support

You can use InfiniteCollectionView to scroll infinitely in a horizontal direction with equally sized cells.


Improvements will include vertical scroll support and support for various cell sizes.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
swift (7,544
uicollectionview (90
scrollview (57
loop (22
infinite (17

Find Open Source By Browsing 7,000 Topics Across 59 Categories