     @IBOutlet private var dismissGesture: UISwipeGestureRecognizer! {
         didSet { dismissGesture.direction = .down }
     }
+    
+    //private var beginPage:Int = -1
+    private var lastContentOffset:CGPoint?
+    private var manualScrollDirection:String?
+    
     @IBOutlet private weak var collectionview: UICollectionView! {
         didSet {
             collectionview.delegate = self

        let pageWidth = scrollView.frame.size.width
        let fractionalPage = scrollView.contentOffset.x / pageWidth
        let page = lroundf(Float(fractionalPage))
        if let count = stories?.count {
            let f_count = count-handPickedStoryIndex
            if page == 0 && scrollView.panGestureRecognizer.translation(in: scrollView.superview).x < 0 {
                nStoryIndex = nStoryIndex + 1
            }else if page != 0 && page != f_count-1 {
                //Here we will be able to get to which kind of scroll user is trying to do!. check(Left.Horizontl.Scroll)
                if scrollView.panGestureRecognizer.translation(in: scrollView.superview).x > 0 {
                    //if user do back scroll then we reducing -1 from iteration value
                    nStoryIndex = nStoryIndex - 1
                }else {
                    //check(Right.Horizontl.Scroll)
                    //if user do front scroll then we adding +1 from iteration value
                    nStoryIndex = nStoryIndex + 1 // go to next story
                }
            }else {
                nStoryIndex = nStoryIndex - 1
            }
        }
    }


import UIKit
import AnimatedCollectionViewLayout

private enum internalScrollType:String {
    case left = "left"
    case right = "right"
    case notscrolled = "notscrolled"
}

public enum layoutType {
    case crossFade,cubic,linearCard,page,parallax,rotateInOut,snapIn,zoomInOut
