It makes me smile every time I notice IGListKit at work in Instagram. We put a lot of work into making and improving it. Proud to see it holding up 4 years later.
🧵 with some memories on how it was built:
At Instagram, product work slowed around the holidays, so we used the time to pay down tech debt. In winter 2014 I reviewed a +12k line refactor from UITableView to UICollectionView.
We recently dropped iOS 5 so we could use the new 6+ APIs without backwards compatibility.
That review taught me a lot about UICV: data sources should mutate in one place else risk out-of-sync exceptions, the first view layout may reloadData, sticky headers make good perf hard, and many more UICV tidbits
We used reloadData for everything and it worked, for the most part.
Except two things bugged the hell out of me:
1. No animated changes (duh)
2. Images could flicker and the like animation could cancel
I dug into the latter and learned that if you reloadData, every cell on screen gets reused. So even if nothing in the UI changes, you still reuse (or init) cells, bind data, set images, etc. that’s a lot of work!