title: Swift UITableView AccessoryType (checkmark)
body: <p>I am using tableview accessory.Type (checkmark) in Tableview(didSelectRowAt:). When user click the row without checkmark, the checkmark will appear. When click the row with checkmark, the checkmark will disappear. Below is the code:</p>
  
  <pre><code>if cell?.accessoryType == .checkmark {
      cell?.accessoryType = .none
  } else {
      cell?.accessoryType = .checkmark
  }
  </code></pre>
  
  <p>The above code is working as expected. When change to the following, it doesn’t work. Any idea?</p>
  
  <pre><code>if cell?.accessoryType == .none {
     cell?.accessoryType = .checkmark
  } else {
      cell?.accessoryType = .none
  }
  </code></pre>
  
  <p>The code is as follows:</p>
  
  <pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      let cell = tableView.cellForRow(at: indexPath)
      if cell?.accessoryType == .checkmark {
          cell?.accessoryType = .none
      } else {
          cell?.accessoryType = .checkmark
      }
  
  }
  </code></pre>