SwiftReorder
SwiftReorder copied to clipboard
two tableview problem
Hi,
I have two tableviews in the vc. I can move from row 1 to row 0 in my first tableview but if I want to move from row 1 to row 0 in my second tableview, it doesn't work.
Can u help me about this problem?
This library only allows dragging cells within a single tableview. If you need to drag cells between multiple table views, you should use the new iOS drag-and-drop apis.
Actually, I asked a different question. I don't wanna use to drag cells between multiple table views. I use as a single each tableviews. Only I have two table views. I drag from row (1,2,3,4,5) to row 0 on my first tableview and it's working. but the second tableview is not working if I drag from (1,2,3,4,5) to row 0.
I attached a video about the problem.
https://youtu.be/cs_FxzoW-Io
I see, I misread your question. Do you have the same view controller as the reorder delegate for both tableviews? It looks like that might be the issue.
I added reorder delegate for both tableviews on the same view controller. I mean yes
In your TableViewReorderDelegate
methods, are you checking which tableview is being interacted with before updating your data model? Like this:
extension MyViewController: TableViewReorderDelegate {
func tableView(_ tableView: UITableView,
reorderRowAt sourceIndexPath: IndexPath,
to destinationIndexPath: IndexPath) {
if tableView == firstTableView {
// Update first data model
} else if tableView == secondTableView {
// Update second data model
}
}
}
Exactly, like this. If drag cells from row (1,2,3,...) to 0, this fuction doesnt work. but it work from row 0 to 1 or row 2 to 3 etc.