This is actually a two part question. First take a look at the code:
//canEditRowAt
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
if tableView.tag == 1000{
return indexPath.row == 0 ? false : true
}
return true
}
//canMoveRowAt
func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
if tableView.tag == 1000{
return indexPath.row == 0 ? false : true
}
return true
}
So from this I would expect that it would prevent the row at index 0 from having other cells move to it, but no... as you can see:
I obviously want to prevent it, but can't seem to find any documentation to solve the issue.
The other bit I'm struggling with; if you look at the recording you can see that once I move a cell into any location, a black bar appears behind the cell. I would like to avoid that from happening as well, and have tried several things but nothing has worked.
Any help is appreciated, thanks!

To answer the first question, if you look at the
tableView(_:canMoveRowAt:)documentation :This mainly talks about the
reordering controlbeing shown rather than specifically saying it can never be moved. So if you look at your UI, thereordering controlis not showing forindexPath.row == 0I can suggest 2 alternatives:
1. Reverse the move action
2. User a header view
This way you don't have to worry about specify any logic of which cells can move and which cannot as you can have the non movable data in a header view:
I recommend the second option as it has the better user experience and seems to be the right way of approaching this problem.
To answer your second question, in your
cellForRowAt indexPathor custom cell implementation, you probably set the background view of the cell or thecontentViewto black.Try setting one of these or both:
This should not give you a black background