 }
 
 extension PagingScrollView: UIScrollViewDelegate {
-  func scrollViewDidScroll(scrollView: UIScrollView) {
-    let pageWidth = scrollView.frame.size.width;
-    let fractionalPage = scrollView.contentOffset.x / pageWidth;
-
+  func checkForPageChange() {
+    if currentIndex != previousPage {
+      viewDelegate?.scrollviewDidScrollToView(reusableViews[Int(currentScrollViewPage)])
+      previousPage = currentIndex
     }
   }
 
+  func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
+    if decelerate {return}
+    checkForPageChange()
+  }
+
+  func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
+    checkForPageChange()
+  }
+
+  func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) {
+    checkForPageChange()
+  }
+}
+

    if fabs(distanceFromCenter) > (contentWidth / 3) {
      if distanceFromCenter > 0 {
        reusableViews.shift(1)
        viewDelegate?.viewRequiresUpdate(reusableViews[2], viewBefore: reusableViews[1])
      } else {
        reusableViews.shift(-1)
        viewDelegate?.viewRequiresUpdate(reusableViews[0], viewAfter: reusableViews[1])
      }
      contentOffset = CGPoint(x: centerOffsetX, y: contentOffset.y)

protocol PagingScrollViewDelegate: class {
  func viewRequiresUpdate(view: UIView, viewBefore: UIView)
  func viewRequiresUpdate(view: UIView, viewAfter: UIView)
  func scrollviewDidScrollToView(view: UIView)
}

class PagingScrollView: UIScrollView {

  weak var viewDelegate: PagingScrollViewDelegate?

  var previousPage: CGFloat = 1

  var currentScrollViewPage: CGFloat {
    get {
      let width = bounds.width
      let centerOffsetX = contentOffset.x + width / 2
      return centerOffsetX / width - 0.5
    }
  }

  var accumulator: CGFloat = 0

  var currentIndex: CGFloat {
    return round(currentScrollViewPage) + accumulator
  }

  var reusableViews = [UIView]()
