Iglistkit: Support for interactive cell movement/reordering

Created on 6 Dec 2016  路  10Comments  路  Source: Instagram/IGListKit

We can add support for moving data, but it will probably be tricky.

For starters, add the UICollectionViewDataSource method collectionView:moveItemAtIndexPath:toIndexPath:. The biggest problem will be moving items between sections, which we probably will have to disable. The two features we can investigate supporting are:

  • Moving items amongst a section
  • Rearranging whole sections
proposal

Most helpful comment

^ Took a shot at it. A bit of a work in progress, but hopefully it gets the ball rolling.

All 10 comments

Originally discussed in #290

I am testing and trying a solution based on IGListKit, to

  • Moving amongst a section
  • Moving across sections
  • By gesture

This should be ok if to operation the collectionview directly, what I worrying about is that the app should also to update the datasource, but next time, calling adapter.performUpdates MAY cause problem.

So if you does not plan to support "moving across sections", would you please help to add a function to adapter to "update the datasource, but without UI updating", so it is possible when special case to directly operate the collectionview and then update the datasource as normal way.

Thanks

Since the IGListAdapter acts as the source of truth, we could easily modify the data source ourselves and then send a delegate event that a transaction occurred (e.g. "moved object o from section 1 to section 3").

You're right that w/out telling the data owner of the move they might update and then things get screwed up.

IGListKit now is able to help the "APP" to move cell easily via IGListAdapter to operate data source.
After this new proposal, IGListKit will help the "USER" to move them cell amongst section.

I'd like to make my preceding comments be clear:
As it's impossible for IGListKit to cover all the possible changes (such as move across sections, or something like move a cell to recyclebin), the developers (the users of IGListKit) may have to directly access CollectionView, and have to directly change the datasource, for these scenarios, IGListKit must be informed that "the datasource be changed, and the UI also be changed by others, so please don't automatically update the UI next time"

@rnystrom - this is done, right?

@jessesquires this is about interactive moves. Something that'd be nice to have, but low pri.

Ahhh 馃憤

Pushing this to 3.1.0

Any update on this? Is anyone working on it?

^ Took a shot at it. A bit of a work in progress, but hopefully it gets the ball rolling.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreamazz picture andreamazz  路  16Comments

RamblinWreck77 picture RamblinWreck77  路  17Comments

jessesquires picture jessesquires  路  19Comments

cikpis picture cikpis  路  16Comments

jessesquires picture jessesquires  路  16Comments