title: Implement didSelect in a collection view inside a cell
body: <p>I am trying to perform a segue from a collection view which is inside a table view cell, the view looks like this </p>
  
  <p><a href="https://i.stack.imgur.com/HiqRI.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>To explain it well,  I have a table view, each row has a cell , inside the second row , I have a collection view which includes several products </p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      switch indexPath.row {
      case 0:
          let cell = tableView.dequeueReusableCell(withIdentifier: "HeaderCell", for: indexPath)
          return cell
      case 1:
          let cell = tableView.dequeueReusableCell(withIdentifier: "ItemTitle", for: indexPath)
          return cell
      case 2:
          let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", for: indexPath)
          return cell
      case 3:
          let cell = tableView.dequeueReusableCell(withIdentifier: "SectionTitle", for: indexPath)
          return cell
      case 4:
          let cell = tableView.dequeueReusableCell(withIdentifier: "CollectionCell", for: indexPath) as! CollectionCell
          return cell
      default:
          let cell = tableView.dequeueReusableCell(withIdentifier: "CollectionCell", for: indexPath) as! CollectionCell
          return cell
      }
  }
  </code></pre>
  
  <p>Inside my ItemCell class I have the following </p>
  
  <pre><code>@IBOutlet weak var collectionView: UICollectionView!
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "singleItemCell", for: indexPath) as! singleItemCell
  
      cell.itemImage.image = images[indexPath.row]
      cell.itemImage.contentMode = .scaleAspectFit
  
  
      return cell
  }
  </code></pre>
  
  <p>I want to perform a segue such as when the user select a cell from the collection view, It takes him to another view controller. How can I do that ? </p>
  
  <p>I tried performSegue but it does not allow me since I am in the cell class</p>
  
  <p>Please any tips ? </p>