Does anyone know why the Apple example of Adopting Drag and Drop in a Table View is not working on iPhone?
Steps to Reproduce:
Drag and drop functionality is not working but it should behave the same way as on the iPad devices. Even the function
func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem]
is not called.
Configuration:
UITableView
& UICollectionView
have dragInteractionEnabled: Bool
instance properties.
Xcode's documentation:
The default value of this property is true on iPad and false on iPhone. Changing the value to true on iPhone makes it possible to drag content from the table view to another app on iPhone and to receive content from other apps.
In TableViewController.swift, add
tableView.dragInteractionEnabled = true
into viewDidLoad()
(I've added it just before the dragDelegate
and dropDelegate
are set, and it seems to work fine).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With