I've implemented checkmarks (when row is selected) with the following code in cellForRowAt
:
// Add a checkmark to row when selected
if selectedIngredients.contains(indexPath.row) {
cell.accessoryType = .checkmark
} else {
cell.accessoryType = .none
}
However, when I select a row, that index.row from each section gets the checkmark:
This seems like it could be because I'm only specifying the indexPath.row, but not the section. How can I code this so that only the selected row within the section I selected gets the checkmark?