     layoutIfNeeded()
   }
 
-  func updateImageConstraints() {
+  public func updateImageConstraints() {
     if let image = imageView.image {
       let imageWidth = image.size.width
       let imageHeight = image.size.height


  var lastZoomScale: CGFloat = -1

  init(frame: CGRect, image: UIImage) {
    super.init(frame: frame)
    imageView.image = image
  }

  required init(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }

  override func didMoveToSuperview() {
    setUpConstraints()
  }

  func setUpConstraints() {
    addConstraint(NSLayoutConstraint(item: scrollView, attribute: .Leading,

import UIKit

public class LightboxView: UIView {

  lazy var imageView: UIImageView = {
    let imageView = UIImageView(frame: CGRectZero)
    return imageView
  }()

  lazy var scrollView: UIScrollView = { [unowned self] in
    let scrollView = UIScrollView(frame: CGRectZero)
    scrollView.delegate = self
    scrollView.addSubview(self.imageView)
    return scrollView
  }()

