 extension ImageView {
 
     func didDoubleTap(_ sender: UIGestureRecognizer) {
-        if self.scrollView.zoomScale == 1.0 {
+        if scrollView.zoomScale == 1.0 {
             let touchPoint = sender.location(in: self)
             scrollView.zoom(to: CGRect(x: touchPoint.x, y: touchPoint.y, width: 1, height: 1), animated: true)
         } else {

        let constraints = [
            progressView.heightAnchor.constraint(equalToConstant: 40.0),
            progressView.widthAnchor.constraint(equalToConstant: 40.0),
            progressView.centerXAnchor.constraint(lessThanOrEqualTo: self.centerXAnchor, constant: 1.0),
            progressView.centerYAnchor.constraint(lessThanOrEqualTo: self.centerYAnchor, constant: 1.0),
            ].map { $0.isActive = true }
     }
    

        var frame = CGRect.zero
        frame.origin = CGPoint.zero
        
        let height = image.size.height * (bounds.width / image.size.width)
        let width = image.size.width * (bounds.height / image.size.height)
        
        if image.size.width > image.size.height {
            
            frame.size = CGSize(width: bounds.width, height: height)
            if height >= bounds.height {
                frame.size = CGSize(width: width, height: bounds.height)
            }
            
        } else {

            frame.size = CGSize(width: width, height: bounds.height)
            if width >= bounds.width {
                frame.size = CGSize(width: bounds.width, height: height)
            }

        }
