title: How can I stop my UITableView from reusing cells?
body: <p>I have a <code>UITableView</code> containing about 30 cells. The user is only able to select one. Once a cell is selected it shows a checkmark. But the problem is whenever I scroll down the <code>UITableView</code> it shows cells i never clicked with a checkmark beside them. What is the proper way to fix this?</p>
  
  <pre><code>override func numberOfSections(in tableView: UITableView) -&gt; Int {
      // #warning Incomplete implementation, return the number of sections
      return 1
  }
  
  override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      // #warning Incomplete implementation, return the number of rows
      return breedNameArray.count
  }
  
  override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Bcell")
      let cell = tableView.dequeueReusableCell(withIdentifier: "Bcell", for: indexPath)
      //cell.accessoryType = UITableViewCell.AccessoryType.checkmark
      cell.textLabel?.text = breedNameArray[indexPath.item]
      return cell
  }
  override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
     tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
      tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath as IndexPath)
      tableView.register(UINib(nibName: "BBcell", bundle: nil), forCellReuseIdentifier: "Cell")
      //let cell = tableView.dequeueReusableCell(withIdentifier: "Breeds", for: indexPath)
      //tableView.deselectRow(at: tableView.indexPathForSelectedRow!, animated: true)
      tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark
  }
  override func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
      tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Bcell")
      //let cell = tableView.dequeueReusableCell(withIdentifier: "Breeds", for: indexPath)
      tableView.cellForRow(at: indexPath)?.accessoryType = .none
  }
  </code></pre>