Open kvenkata1974 opened 5 years ago
I should be using the drag and drop delegate of the collection view, will try that first.
Sorry, tried using UICollectionViewDelegate and implemented the methods (extended SwiftDataTable since it already implements the protocol):
func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool {
return true
}
func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
print("Starting Index: \(sourceIndexPath.item)")
print("Ending Index: \(destinationIndexPath.item)")
}
But I could not get reorder of items via drag and drop to be triggered. Please help.
Yeah I didn't have this in mind and not sure how adopting those methods will affect the ordering of the swift data tables datasource. Come to think of it, I believe you'll need to update the datasource yourself once you figure out where the user wants to drag and drop an item. You'll then need to refresh the collection view to reflect the changes.
Hi, I'm using version 0.8 of SwiftDataTables.
Can the rows not be reorder via drag and drop?
Was hoping the delegate would allow for drag and drop of rows.
Cheers Karthik