title: Get original image size after UIPinchGestureRecognizer pinch in and out
body: <p>I would like to return the original image size after I use pinch gesture to zoom in or out.</p>
  
  <p>What I have found the similar answer is </p>
  
  <p><a href="https://stackoverflow.com/questions/32139184/how-to-get-original-image-when-we-zoom-in-and-zoom-out-the-image-in-ios">How to get original image when we zoom in and zoom out the image in ios</a>, </p>
  
  <p>it uses scrollView. Not exactly what I need.</p>
  
  <p>Here is my code, It's a gesture response sent by #selector</p>
  
  <pre><code>func respondToGesture(_ gesture: UIGestureRecognizer) -&gt; Void {
  
      if let pinch = gesture as? UIPinchGestureRecognizer {
  
          if let img = pinch.view as? UIImageView {
  
             img.transform = CGAffineTransform(scaleX: pinch.scale, y: pinch.scale)
  
             if pinch.state == .ended
             {
                 img.transform = CGAffineTransform(scaleX: (1 / pinch.scale), y: (1 / pinch.scale))
             }
          }
      }
  }
  </code></pre>
  
  <p>Hope to get some suggestions!! Thanks~</p>