title: Change ImageView image on UICollectionViewCell on Tap
body: <p>I have a <code>UICollectionView</code> which uses custom <code>xib</code> file for it's cells. In the cell I have an <code>ImageView</code> for check box. I want to change the image of the `ImageView1 when it was taped. I tried the following code snippet but, it's not working for me</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! V_Cell
  
      if show_delete == true {
          cell.img_delete.image = UIImage(named: "checked")
      }
  }
  
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! V_Cell
  
      // Configure the cell
  
      let data = valves_[indexPath.row]
      cell.v_name.text = data
  
      if show_delete == true {
          cell.img_delete.isHidden = false
      } else if show_delete == false {
          cell.img_delete.isHidden = true
      }
  
      return cell
  }
  </code></pre>
  
  <p>In this code I've tried to change the image of <code>ImageView</code> in <code>didSelectItemAt</code>. </p>
  
  <p>My custom <code>xib</code> file is as following.</p>
  
  <p><a href="https://i.stack.imgur.com/ivJGO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ivJGO.png" alt="enter image description here"></a></p>
  
  <p>Please suggest a way to make it work. Thanks.</p>