title: Get Cell Image from UICollectionView in Swift 4
body: <p>I created a UICollectionView and created a Custom cell.</p>
  
  <p>I put the image in the custom cell and returned the cell.</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell
  {
      guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HomeCollectionViewCell", for: indexPath) as? HomeCollectionViewCell,
      let arts = self.artList else { return HomeCollectionViewCell() }
  
      if arts.count &gt; indexPath.row
      {
          let model = arts[indexPath.row]
  
          cell.imgView.sd_setImage(with: URLHelper.createEncodedURL(url: model.url), completed: nil) // set cell image
      }
  
      return cell
  }
  </code></pre>
  
  <p>Then, we execute a function that sets the vertical size of the cell.</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, heightForPhotoAtIndexPath indexPath: IndexPath) -&gt; CGFloat
  {
      // get cell information
  
      return // cell Image Height
  }
  </code></pre>
  
  <p>However, I do not know how to get cell information (cell vertical value) from this function.</p>
  
  <p>What should I do?</p>