title: How to change selected color for table view cell?
body: <p>When I select on a cell on my table view, it changes into this white color. I want to change it. </p>
  
  <p><a href="https://i.stack.imgur.com/nx1nh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nx1nh.png" alt="enter image description here"></a></p>
  
  <p>I tried using an if statement but it didn't work. </p>
  
  <p>Here is the code that I used.</p>
  
  <pre><code>override func tableView(_ tableView: UITableView, cellForRowAt 
  indexPath: IndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCell(withIdentifier: "cellId", for: indexPath)
  
      if cell.isSelected == true {
          cell.backgroundColor = .blue
      } else {
          cell.backgroundColor = .red
      }
  
      return cell
  
  }
  </code></pre>