title: Change image on select within tableview cell - Swift
body: <p>I am trying to change an image within a cell when it is selected. Here is what I have in my view controller:</p>
  
  <pre><code>func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  
  let cell = self.tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CustomTableViewCell
  
          cell.bgImage.image = UIImage(named: "second_image")
  
  }
  </code></pre>
  
  <p>This is where I set the image:</p>
  
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
  let cell = self.tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CustomTableViewCell
  
  cell.bgImage.image = UIImage(named: "first_image")
  
  }
  </code></pre>
  
  <p>When I select the cell, the image does not update. How do I get this to work?</p>