             metrics: nil,
             views: views
         )
-        self.view.addConstraints(constraintVertical)
-        self.view.addConstraints(constraintHorizontal)
+        view.addConstraints(constraintVertical)
+        view.addConstraints(constraintHorizontal)
     }
 }
 // MARK: - UIScrollViewDelegate

    
    public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {

        if self.previousPage != self.currentPage {

            // If page index has changed - reset zoom scale for previous image.
            let imageView = self.imageViews[self.previousPage]
            imageView.scrollView.zoomScale = imageView.scrollView.minimumZoomScale
            
            // Show Caption Label
            self.updateCaption()

        }
        
        self.scrollMode = .None

    }
}

            
            let screenHeight = UIScreen.main.bounds.size.height
            
            if scrollView.contentOffset.y > screenHeight * 1.4 {
                closePhotoSlider(up: true)
            } else if scrollView.contentOffset.y < screenHeight * 0.6  {
                closePhotoSlider(up: false)
            }
            
        } else if self.scrollMode == .Horizontal {
            var contentOffset = scrollView.contentOffset
            contentOffset.y = scrollPreviewPoint.y
            scrollView.contentOffset = contentOffset
        }
        
