Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView reordering: interactive movement or drag and drop?

As of iOS 9, UICollectionView supports interactive movement via beginInteractiveMovement and its sibling methods. As of iOS 11, it also supports drag and drop, which seems to support movement as well. In iOS 13 beta 4, drag and drop gestures have been combined with UIContextMenuInteraction animations (Twitter link) so you can transition from a context menu to a drag operation, but the same isn't true when reordering via the interactive movement APIs.

Is it better to implement interactive movement of items in a collection view using drag and drop going forward?

like image 669
Tom Hamming Avatar asked Jul 17 '19 21:07

Tom Hamming


1 Answers

It is better to migrate to UICollectionViewDragDelegate and UICollectionViewDropDelegate. I recently had a task where I had to combine context menu, reordering (after activation via context menu) and UICollectionViewCompositionalLayout with orthogonal sections. I have to say, that if you use gesture recognizers and interactive movement, it will break scrolling in all orthogonal sections.

like image 107
eagle.dan.1349 Avatar answered Sep 28 '22 02:09

eagle.dan.1349