Drag and drop to move items in UICollectionView and UITableView does not work when dragging multiple items

Originator:poppoppop
Number:rdar://33413316 Date Originated:July 20 2017
Status:Open Resolved:
Product:iOS Product Version:11
Classification: Reproducible:Always
 
Summary:
The drag and drop delegate APIs on UICollectionView and UITableView are wonderful for rearranging a single item in a view or dragging in single or multiple items. Unfortunately they do not currently support rearranging multiple items at once. As soon as an additional item is added to a drag session from the same collection view or table view then that session can no longer be dropped on that view.

It's worth emphasising that dragging in multiple items is fine, and selecting a single element from a collection view or table view and then adding more items to the drag session from other views is fine too, but as soon as there are two items added from that view itself dropping becomes forbidden.

Steps to Reproduce:
1. Create a UICollectionView or UITableView with drag and drop delegates set and implemented and enable the views drag interaction
2. Drag a single cell around and note that the collection view or table view animates to indicate where the cell will be moved if you perform a drop
3. Tap another cell to add it to the drag session

Expected Results:
There are now two items in the drag session and I can drop them wherever I want them to be placed together in the collection view or table view

Observed Results:
There are now two items in the drag session and dropping them anywhere on the collection view or table view is a forbidden operation

Version:
iOS 11 beta 3

Notes:
You can see this issue in the Photos app on iOS 11 beta 3 if you navigate to a photo album and start rearranging the photos. Once you add a second photo to your drag you can no longer drop the photos in that album.

I am also attaching a sample project that demonstrates this issue. It is a slightly modified version of the sample code from the "Drag and Drop with Collection and Table View" session at https://developer.apple.com/videos/play/wwdc2017/223/

I amended the project to make it a Universal app instead of iPad and to add `collectionView?.dragInteractionEnabled = true` to `PhotoCollectionViewController` and enable the drag behaviour there.

If you launch that app (I believe it needs to be on a device because it accesses the photo library) and navigate to one of the photo albums you will see that you are able to rearrange a single photo in the collection view but once you add a second photo to that drag session you are no longer able to rearrange the photos within that view.

Comments

Any progress on this problem?

I have the same problem on IOS 11.4 and 12.1, on both iPhone and iPad, in both simulators and on hardware. The main difference for me is that I am doing this in an iMessage app extension.

By njustusson at Nov. 29, 2018, 12:31 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!