title: UIImageView pinch zoom within Cell using Swift
body: <p>I would like to add a function which permits to zoom on an image.</p>
  
  <p>I'm new to swift, my problem is probably stupid: I would like to add <code>UIScrollViewDelegate</code> in order to have this function.</p>
  
  <p>The problem is that the image and the scrollView are within a TableViewCell. So I tried to add that delegate function in the Cell class but it did not work.</p>
  
  <p>How can I do that?</p>
  
  <pre><code>class PhotoDetailViewControllerCell: UITableViewCell, UIScrollViewDelegate {
  
      @IBOutlet weak var scrollView: UIScrollView!
      @IBOutlet weak var imgPhoto: UIImageView!
  
      override func awakeFromNib() {
      super.awakeFromNib()
  
          scrollView.minimumZoomScale = 1.0
          scrollView.maximumZoomScale = 6.0        
          // scrollView.delegate = self - it is set on the storyboard.
      }  
  
      func viewForZooming(in scrollView: UIScrollView) -&gt; UIView? {
  
          return imgPhoto
      }
  </code></pre>
  
  <p>If I want to call that function in the <code>TableViewController</code>, I can't return imgPhoto because the outlet is in the Cell.</p>