Iglistkit: Add scrolling method to IGListCollectionContext

Created on 30 Nov 2016  路  4Comments  路  Source: Instagram/IGListKit

Scenario

  1. There's an "expandable cell" in a list. Tap it to toggle collapse/expand, via -didSelectItemAtIndex:
  2. After it is expanded, the larger cell isn't completely on screen (it's the last cell)
  3. From the SectionController, I need to say "scroll to bottom"

There's no way to do this currently, given the collectionContext available to SectionController objects. However, all the functionality is there.

Proposal

Add this scrolling method on IGListAdapter to the IGListCollectionContext protocol. This gives us everything we need, and it's a minimal change.

Also, why is IGListCollectionContext conformance not public on IGListAdapter ? I don't really see any negatives to this?

Alternative

Maybe that scrolling method gives a SectionController too much knowledge. In that case, we could expose the regular collection/scroll view methods for this.

enhancement proposal

All 4 comments

cc @rnystrom -- Thoughts ?

We could add a method like

- (void)scrollToSectionController:(...)sectionController atIndex:(NSInteger)index direction/position/animated;

I think its reasonable they have this behavior.

Also, why is IGListCollectionContext conformance not public on IGListAdapter ? I don't really see any negatives to this?

Originally to hide the inner workings. No downside, but at the same time you don't want people knowing the adapter is the context, then internally doing stuff like [(IGListAdapter *)self.collectionContext visibleSectionControllers].

Though its not the end of the world, it'll let global-state creep in.

Just chatted w/ folks internally that need this feature now. @jessesquires lmk if you have time to knock it out in the next few days, otherwise I can handle it.

I think a simple API on the context should be fine for now. Can nab the section controller section, create an index path, then just call the UICollectionView scroll method.

@rnystrom -- Cool, will do this today 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joseph-francis picture joseph-francis  路  3Comments

HarshilShah picture HarshilShah  路  3Comments

rnystrom picture rnystrom  路  3Comments

rnystrom picture rnystrom  路  3Comments

FazeelAkhtar picture FazeelAkhtar  路  3Comments