Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two tableview problem #71

Open
koust opened this issue Jun 5, 2020 · 6 comments
Open

two tableview problem #71

koust opened this issue Jun 5, 2020 · 6 comments

Comments

@koust
Copy link

koust commented Jun 5, 2020

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?

@adamshin
Copy link
Owner

adamshin commented Jun 5, 2020

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.

@koust
Copy link
Author

koust commented Jun 7, 2020

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

@adamshin
Copy link
Owner

adamshin commented Jun 8, 2020

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.

@koust
Copy link
Author

koust commented Jun 8, 2020

I added reorder delegate for both tableviews on the same view controller. I mean yes

@adamshin
Copy link
Owner

adamshin commented Jun 9, 2020

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
        }
    }
}

@koust
Copy link
Author

koust commented Jun 10, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants