in my project I was just adding this line of code to add a little checkmark next to the cell that the user selects. (In did select row at function)
let currentCell = tblView.cellForRow(at: indexPath)! as UITableViewCell
currentCell.accessoryType = .checkmark
The currentCell is printing fine. For example, when I print out the cell, it gives me the cell's frame; text; clipsToBounds; autoresize; layer:0>. When I add this line of code though, as expected, it does add check mark on that cell, but also every other 15 cells, starting from that cell- and it looks like this 
Does anyone know why this is happening, and how I could fix this?
That's not how you use a table view.
Table view cells are reused. The checkmark appeared on a cell you didn't tap on because that actually the same
UITableViewCellobject as a cell that you did tap on, but since that cell has been scrolled out of view, it is re-displayed again at the bottom, just with a different label text.The correct thing to do in
didSelectRowis to update your model. Right now, you are probably using an array of things as the data source of the table view:Now you just need to also store which things are selected and which are not in your model, in some way or another. E.g. in another array:
Initialise it like this:
In
didSelectRow, updatethingsSelectionStatusesand reload the cell.Reloading the cell will lead to
cellForRowAtbeing called. IncellForRowAt, we set theaccessoryTypedepending onthingsSelectionStatuses: