UITableViewDropCoordinator.drop(_:toRowAt:) doesn't work
| Originator: | an00na | ||
| Number: | rdar://33160997 | Date Originated: | July 6 2017, 12:40 PM |
| Status: | Closed | Resolved: | Behaves as Intended |
| Product: | iOS + SDK | Product Version: | 11.0 beta 2 |
| Classification: | UI/Usability | Reproducible: | Always |
Area: UIKit Summary: UITableViewDropCoordinator.drop(_:toRowAt:) has no effect. I don't see any drop animation. Steps to Reproduce: 1. Launch sample app. 2. Drag some text from another app and drop into the list. Expected Results: There should be a drop animation. Observed Results: No drop animation. Code: https://mega.nz/#!NawUkLYC!b0GFJ2bvKb-LnklWuO5-RW_9jvJWwX9dbT73N_5IUdc
Comments
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!
Apple Developer Relations July 17 2017, 11:11 PM
The reason the drop animations do not work is because the attached sample app calls drop(_:toRowAt:) after the tableView(_:performDropWith:) method returns, because it is inside a closure that runs asynchronously once the data is loaded.
Drop animations must be specified before returning from tableView(_:performDropWith:), and in cases like this where the data is loading asynchronously you should insert and animate to placeholders which are replaced once the data loads.
Please see the WWDC 2017 Session 223 - Drag and Drop with Collection and Table View: https://developer.apple.com/videos/play/wwdc2017/223/ as well as the associated sample project that contains examples of how to implement this: https://developer.apple.com/sample-code/wwdc/2017/Drag-and-Drop-in-UICollectionView-and-UITableView.zip