Bug while reordering a single section item to the last spot and back
General information
IGListKitversion: master branch- iOS version(s): 10.0-12.0
- CocoaPods/Carthage version:
- Xcode version: 10.1
- Devices/Simulators affected: All
- Reproducible in the demo project? (Yes/No): Yes
- Related issues:
Hi,
I've detected the following bug in the interactive reordering mechanism:
On UICollectionViewLayout+InteractiveReordering, interactive transaction between two single-item sections and destination of the last spot is treated uniquely as follow:
// if we're moving an item to the last spot, our index would exceed the number of sections available
// so we have to special case this scenario. iOS doesnt allow an item move to "create" a new section
adapter.isLastInteractiveMoveToLastSectionIndex = YES;
The problem is, that this logic is done in the method updatedTargetForInteractivelyMovingItem:toIndexPath:adapter: which is called repeatedly during the interactive dragging. Therefore, I can start dragging a single section item to the last spot in the collection view, and by that setting (while still dragging) adapter.isLastInteractiveMoveToLastSectionIndex to YES and then drag the item back (without ever lifting up the finger) to a non-last spot while adapter.isLastInteractiveMoveToLastSectionIndex is still YES. If I will end the dragging then, the adapter will update the items as if the item was dragged to the last spot (because adapter.isLastInteractiveMoveToLastSectionIndex is still set to YES).
