   
   public override func viewDidAppear(animated: Bool) {
     super.viewDidAppear(true)
-    let config = LightboxConfig.sharedInstance.config
     
     if config.hideStatusBar {
       UIApplication.sharedApplication().setStatusBarHidden(true,


public class LightboxController: UIViewController {

  var images = [String]()

  public var delegate: LightboxControllerDelegate?

  var collectionSize = CGSizeZero

  public private(set) var page = 0 {
    didSet {
      let config = LightboxConfig.sharedInstance.config.pageIndicator
      let text = "\(page + 1)/\(images.count)"
      
      pageLabel.attributedText = NSAttributedString(string: text,
        attributes: config.textAttributes)
      pageLabel.sizeToFit()

      delegate?.lightboxControllerDidMoveToPage(self, page: page)

    return collectionView
    }()

  lazy var collectionViewLayout: UICollectionViewLayout = { [unowned self] in
    let layout = CenterCellCollectionViewFlowLayout()
    
    layout.scrollDirection = .Horizontal
    layout.minimumInteritemSpacing = self.config.spacing
    layout.minimumLineSpacing = self.config.spacing
    layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
    
    return layout
    }()

  lazy var pageLabel: UILabel = { [unowned self] in
    let label = UILabel(frame: CGRectZero)
    
    label.setTranslatesAutoresizingMaskIntoConstraints(false)
    label.hidden = !self.config.pageIndicator.enabled
    
    return label
    }()
  
  lazy var closeButton: UIButton = { [unowned self] in
    let title = NSAttributedString(
      string: self.config.closeButton.text,
      attributes: self.config.closeButton.textAttributes)
    let button = UIButton.buttonWithType(.System) as! UIButton
    
    button.setTranslatesAutoresizingMaskIntoConstraints(false)
    button.setAttributedTitle(title, forState: .Normal)
    button.addTarget(self, action: "closeButtonDidTouchUpInside:",
      forControlEvents: .TouchUpInside)
    if let image = self.config.closeButton.image {
      button.setImage(image, forState: .Normal)
    }
    
