I'm trying to use UITableViewDiffableDataSource to implement a UITableView which supports reordering.
Firstly, I set tableView.isEditing = true.
Then I subclassed UITableViewDiffableDataSource in order to override func tableView(_: UITableView, canMoveRowAt _: IndexPath) -> Bool however it does not work.
After that, I also override func tableView(_: UITableView, canEditRowAt _: IndexPath) -> Bool and the reorder control showed up.
However, the leading delete button cannot be hidden. So I wrote this code:
Unfortunately, the left indent for the delete still keeps.
So I add this kind of code to disable the leading indent:
But it does not work at all.
Anything I can do?
I published all the code for reproduction:
Firstly, I set tableView.isEditing = true.
Then I subclassed UITableViewDiffableDataSource in order to override func tableView(_: UITableView, canMoveRowAt _: IndexPath) -> Bool however it does not work.
After that, I also override func tableView(_: UITableView, canEditRowAt _: IndexPath) -> Bool and the reorder control showed up.
However, the leading delete button cannot be hidden. So I wrote this code:
Code Block override func tableView(_: UITableView, editingStyleForRowAt _: IndexPath) -> UITableViewCell.EditingStyle { .none // Disable the delete button BUT there's unexpected left indent }
Unfortunately, the left indent for the delete still keeps.
So I add this kind of code to disable the leading indent:
Code Block cell.shouldIndentWhileEditing = false // Code to disable left indent does not work at all
But it does not work at all.
Anything I can do?
I published all the code for reproduction: