IGListKit

Today we are going to explore IGListKit, a data-driven UICollectionView framework for building fast and flexible lists. IGListKit is an open source project from Instagram.

The reasoning behind this library is that UICollectionView can be hard to work with sometimes. The library is a pattern that emerges from the Refactoring of the Instagram Feed. You can read more about it here.

A great (and fun) tutorial is IGListKit Tutorial: Better UICollectionViews if you want to learn how to use the library. In this tutorial by Ryan Nystrom you will go trough an application initially developed only using UICollectionView to one where we use IGListKit to add new features in a short time to market (or space).

You can check the final project here. The application serves as support to an Astronaut exploring Mars:

realtime

The library has the main components:

  • IGListAdapter and IGListAdapterDataSource
  • IGListSectionController that implements IGListSectionType
  • IGListCollectionView, the collection view
  • IGListAdapterUpdater that implements IGListUpdatingDelegate

To use it we have our Data that conforms to IGListDiffable, and we create different section controllers for the different types of data we have. Then in our view controller we create an adapter, connect a collection view and a data source.

flowchart-650x357.png

We also created a simpler example only with a Label cell and some hardcoded data, you can  find it here.

Leave a comment