Iglistkit: "visible" section controllers

Created on 14 Apr 2017  路  3Comments  路  Source: Instagram/IGListKit

- (NSArray<IGListSectionController<IGListSectionType> *> *)visibleSectionControllers; in IGListAdapter is not all visible section controllers sometimes.

For example, in a list, there is a section controller, with zero cell, but there's a header, footer or other supplementary view. So the section controller is still "visible".

bug starter-task

Most helpful comment

@rnystrom I took a stab at implementing your fix idea + added a unit test!

All 3 comments

Ah ya, we're only using -[UICollectionView visibleCells] atm, but absolutely not perfect. Tracking visible supplementary views is much more complicated b/c

  • visibleSupplementaryViewsOfKind: is iOS 9+
  • Requires knowing element kinds ahead of time

Maybe instead we should query -[UICollectionViewLayout layoutAttributesForElementsInRect:] w/ collectionView.bounds and just nab -[UICollectionViewLayoutAttributes indexPath] to build a set of section controllers?

Should be easy to unit test too.

@rnystrom Want to card that up separately? Seems like a nice starter task!

@rnystrom I took a stab at implementing your fix idea + added a unit test!

Was this page helpful?
0 / 5 - 0 ratings