Group Group Group Group Group Group Group Group Group

Beginning Table Views · Conclusion | Ray Wenderlich


This is a companion discussion topic for the original entry at


Hi, I think there is an error in the app. When you move the cells out of the screen with your fingers and then let them show again, they are recycled by calling tableView.dequeueReusableCell(). The problem is (in my opinion) that you call configureCheckmark() next, which changes the CheckListItem.checked every time you do this. Shoudn’t you have another function for setting the checkmark state for recycled cells, which just reads CheckListItem.checked, sets the cell.accessoryType accordingly, but doesn’t change its value?
Thank You,



I’ll have to check it out - thanks for the heads up.



I had the same bug that @honzakxt pointed out. I solved this for now by having the tableView.dequeueReusableCell() call a new method called getCheckmark(), which is essentially what @honzakxt suggested above. It is the same as configureCheckmark(), but without the call to toggle the checked value.

Not an ideal solution as it basically repeats the configureCheckbox code except for the one line. And so, I refactored the configureCheckmark method to call the getCheckmark method like so:

func configureCheckmark(for cell: UITableViewCell, with item: ChecklistItem) {
    getCheckmark(for: cell, with: item)
  func getCheckmark(for cell: UITableViewCell, with item: ChecklistItem) {
    if item.checked {
      cell.accessoryType = .checkmark
    } else {
      cell.accessoryType = .none

Lastly, I would note that I changed the code in the video to add the checkmark accessoryType when the item.checked it true and ‘none’ when checked is false.



@chuck_taylor Thank you for sharing your solution - much appreciated! :]



Same problem: Checkmarks will be reused in a random way when they go outside the visible area.