         }
     }
 
-    private func moveScrollViewView(x: CGFloat, duration: TimeInterval) {
+    private func moveScrollView(x: CGFloat, duration: TimeInterval) {
 
         let direction = behaviorDirection(x: x)
         reusedView(direction: direction)


        if currentPage == 0 {
            let x = -scrollView.contentInset.left
            moveScrollViewView(x: x, duration: duration)
        }
        else if currentPage == numberOfPages - 1 {
            let x = scrollView.contentSize.width - scrollView.bounds.width + scrollView.contentInset.right
            moveScrollViewView(x: x, duration: duration)
        }
        else if CGFloat(currentPage) * itemSize <= scrollView.contentOffset.x + itemSize {
            let x = scrollView.contentOffset.x - itemSize
            moveScrollViewView(x: x, duration: duration)
        }
        else if CGFloat(currentPage) * itemSize + itemSize >=
            scrollView.contentOffset.x + scrollView.bounds.width - itemSize {
            let x = scrollView.contentOffset.x + itemSize
            moveScrollViewView(x: x, duration: duration)
        }
    }



        super.layoutSubviews()
        
        scrollView.center = CGPoint(x: bounds.width / 2, y: bounds.height / 2)
    }

    public override var intrinsicContentSize: CGSize {
