title: Detect tap on UIViewCollectionCell inside UITableViewCell
body: <p>I want to detect a tap on imageview in uicollectionviewcell inside uitableviewcell</p>
  
  <p>I'm using an api response to build a data in my tableview</p>
  
  <p>I have this API response:</p>
  
  <pre><code>{"status":1,"data":{"blocks":[{"name":"CustomBlock","description":"CustomDescription","itemsType":"game","items":[510234,78188,15719,37630]}], "items":[{"id:"1", name: "testgame"}]}
  </code></pre>
  
  <p>BlocksViewController.swift</p>
  
  <pre><code>class BlocksViewController: UIViewController, UITableViewDataSource, UICollectionViewDataSource, UICollectionViewDelegate, UITableViewDelegate {
  var blocks = [Block]() // I'm getting blocks in this controller
  var items : BlockItem! // and items
  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      return blocks[collectionView.tag].items.count
  }
  
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "GameCollectionCell", for: indexPath) as? GameCollectionCell else { return
          UICollectionViewCell() }
  
      if let found = items.game.first(where: {$0.id == String(blocks[collectionView.tag].items[indexPath.row])}) {
          cell.gameName.text = found.name
          cell.gameImage.kf.indicatorType = .activity
  
          let processor = DownsamplingImageProcessor(size: CGSize(width: 225, height: 300))
          cell.gameImage.kf.setImage(
              with: URL(string: found.background_image ?? ""),
              options: [
                  .processor(processor),
                  .scaleFactor(UIScreen.main.scale),
                  .transition(.fade(0.2)),
                  .cacheOriginalImage
              ])
      }
      else {
          cell.gameName.text = ""
          cell.gameImage.image = nil
      }
      return cell
  }
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return blocks.count
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      guard let cell = tableView.dequeueReusableCell(withIdentifier: "BlockCell") as? BlockCell else { return UITableViewCell() }
      cell.blockName.text = blocks[indexPath.row].name
      cell.blockDescription.text = blocks[indexPath.row].description
      cell.setScrollPosition(x: offsets[indexPath] ?? 0)
      cell.gameCollectionCell.delegate = self
      cell.gameCollectionCell.dataSource = self
      cell.gameCollectionCell.tag = indexPath.row
      cell.gameCollectionCell.reloadData()
      return cell
  }
  </code></pre>
  
  <p>I'm getting blocks and items in this controller. Now i want to detect a tap using LongTapGestureRecognizer on image in gamecollectionCell(UIcollectionViewCell inside BlockCell(TableviewCell). How can i do this? Or maybe any advice how to improve logic here?</p>
  
  <p>Okay, i've added gesture recognizer like this in cellForItemAt :</p>
  
  <pre><code>cell.addGestureRecognizer(UILongPressGestureRecognizer.init(target: self, action: #selector(addGamePopUp)))
  </code></pre>
  
  <p>Then i need to animate uiimageview on long tap. </p>
  
  <pre><code>var selectedGameCell : GameCollectionCell?
  
      func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
      self.selectedGameCell = collectionView.dequeueReusableCell(withReuseIdentifier: "GameCollectionCell", for: indexPath) as? GameCollectionCell 
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>@IBAction func addGamePopUp(_ sender: UILongPressGestureRecognizer) {
      if (sender.state == UIGestureRecognizer.State.began){
          UIView.animate(withDuration: 0.3, animations: {
              self.selectedGameCell?.gameImage.transform = CGAffineTransform(scaleX: 0.95,y: 0.95);
          }) { (Bool) in
              UIView.animate(withDuration: 0.3, animations: {
                  self.selectedGameCell?.gameImage.transform = CGAffineTransform(scaleX: 1,y: 1);
              });
          }
      }
  }
  </code></pre>
  
  <p>But it still doesn't work. Did i miss something?</p>