-
Notifications
You must be signed in to change notification settings - Fork 74
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
Move row in moving section failed in TableView #29
Comments
Thanks for the report, and for the reproduction! |
Huh, yeah, this is a really odd one. How did you figure it was a |
It's my tip. I wrote test that compares content in cells (extracted from subviews of tableView) with model. private extension UITableView {
var testDescription: String {
return subviews
.sorted {
$0.frame.origin.y < $1.frame.origin.y
}.reduce("") { accum, current in
let appendix: String
if let text = (current as? UITableViewCell)?.textLabel?.text {
appendix = "\(text);"
} else if let headerFooterText = (current as? UITableViewHeaderFooterView)?.textLabel?.text {
appendix = "\(headerFooterText);"
} else if let text = (current as? UILabel)?.text {
appendix = "\(text);"
} else if current is UIImageView {
appendix = ""
} else {
print("Unknown \(current)")
fatalError()
}
return accum + appendix
}
}
} but it succeeded 🤦🏻♂️. It's weird that unit test succeeded but real use on device failed. It's possible to fix this case with two update blocks. First update without rows move in moving section and then move rows. I have working version of this. There is one more problem with reload row in moving section as I know now. Maybe we can try insert and delete in moving section. |
Hi @jcislinsky, I'm currently trying to find a solution to this problem since even You mentioned applying the updates through two update blocks. While this works for this simple case, I don't believe we can make it work for every possible scenario because the intermediate state needs to be valid for But maybe I am misunderstanding what you were trying to do. Could you please elaborate on your idea a bit? |
Hi,
I just reached to problem with moving rows inside of section that is moved in the same update. Example app (
NestedTableViewController
) have this issue. I updated items in https://github.com/EtneteraMobile/Differ/tree/test-move to highlight invalid behaviour.This is result of update, where section are switched and rows inside are switched too.
Expected result: Second – 2, 1; First – 2, 1
Invalid result: Second – 2, 1; First – 1, 2
It seems to be bug in UITableView that doesn't perform move in section that is moving.
The text was updated successfully, but these errors were encountered: