 
     collectionView.setTranslatesAutoresizingMaskIntoConstraints(false)
     collectionView.pagingEnabled = true
-    collectionView.backgroundColor = .redColor()
+    collectionView.backgroundColor = .blackColor()
     collectionView.dataSource = self.dataSource
     collectionView.delegate = self
 

    if page >= 0 && page < images.count {
      var offset = collectionView.contentOffset
      offset.x = CGFloat(page) * collectionView.frame.size.width
      collectionView.setContentOffset(offset, animated: animated)
    }
  }

  public func next(animated: Bool = true) {
    page++
    goTo(page, animated: animated)
  }

  public func previous(animated: Bool = true) {
    page--
    goTo(page, animated: animated)
  }
}



  public func scrollViewDidScroll(scrollView: UIScrollView) {
    let pageWidth = collectionView.frame.size.width
    let currentPage = Int(floor((collectionView.contentOffset.x - pageWidth / 2) / pageWidth) + 1)
    if currentPage != page {
      page = currentPage
    }
  }
}
