title: Change button state if a row in tableView is selected
body: <p>I have a tableView when a row is selected I would like to show a button on the bottom (outside of the tableView) to be shown (isEnabled = true) when I have no rows selected I want it to be set to disabled (isEnabled = false. How can I handle this the best?</p>
  
  <p>Currently I have this logic but when I try to select multiple rows this gives me issues. Because the first select will enable it and the second will disable it.</p>
  
  <p>Here is the code:</p>
  
  <p>I store a true or false in a var on the top called: var someRowSelected = false</p>
  
  <pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  
          let selectedCell = tableView.cellForRow(at: indexPath)
          selectedCell?.contentView.backgroundColor = UIColor(red: 84.0 / 255, green: 199.0 / 255, blue: 252.0 / 255, alpha: 1)
  
  
          if(!someRowSelected){
              self.someRowSelected = true
              nextBtn.isEnabled = true
              nextBtn.backgroundColor = UIColor(red: 84.0 / 255, green: 199.0 / 255, blue: 252.0 / 255, alpha: 1)
          }else{
              self.someRowSelected = false
              nextBtn.isEnabled = false
              nextBtn.backgroundColor = UIColor.darkGray
          }
  
      }
  
      func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
          let selectedCell = tableView.cellForRow(at: indexPath)
          selectedCell?.textLabel?.textColor = UIColor.darkGray
  
          if(!someRowSelected){
              self.someRowSelected = true
              nextBtn.isEnabled = true
              nextBtn.backgroundColor = UIColor(red: 84.0 / 255, green: 199.0 / 255, blue: 252.0 / 255, alpha: 1)
          }else{
              self.someRowSelected = false
              nextBtn.isEnabled = false
              nextBtn.backgroundColor = UIColor.darkGray
          }
      }
  </code></pre>
  
  <p>I am curious if someone can help me out. </p>
  
  <p>Thank you! :)</p>