 
 class ACScrollNavigationBar: UINavigationBar, UIGestureRecognizerDelegate {
   
-  var scrollState = ACScrollNavigationBarState.None
+  var scrollState: ACScrollNavigationBarState = .None
   var lastContentOffsetY: CGFloat = 0.0
+  
   var panGesture = UIPanGestureRecognizer()
+  var gestureIsActive = false
   
   var scrollView: UIScrollView? {
     didSet {

      // move the navbar
      self.frame = newFrame
      
      // move the scrollviews parent view by the offset...check to make sure we have a scrollView first
      if let myScrollView = self.scrollView {
        var parentViewFrame = myScrollView.superview?.frame
        parentViewFrame?.origin.y += offsetY
        parentViewFrame?.size.height -= offsetY
        myScrollView.superview?.frame = parentViewFrame!
      }
      
    }
    
    // Animate the moveFrame() changes if desired, otherwise just execute them

      var maxY = statusBarHeight
      var minY = maxY - CGRectGetHeight(newFrame) + 1.0
      
      let isScrolling = scrollState == .ScrollingUp || scrollState == .ScrollingDown
      gestureIsActive = gesture.state != .Ended && gesture.state != .Cancelled
      
      if isScrolling && !gestureIsActive {
        var contentOffsetYDelta: CGFloat = 0.0
        if scrollState == .ScrollingDown {
          contentOffsetYDelta = maxY - newFrame.origin.y
