     }
     
     func getStatusBarHeight() -> CGFloat {
-        var statusBarFrameSize: CGSize = UIApplication.sharedApplication().statusBarFrame.size
+        var statusBarFrameSize = UIApplication.sharedApplication().statusBarFrame.size
         return statusBarFrameSize.height
     }
 }


extension UIViewController {
    func showNavigationBar(animated: Bool) {
        let statusBarHeight: CGFloat = getStatusBarHeight()
        
        let appKeyWindow: UIWindow = UIApplication.sharedApplication().keyWindow!
        let appBaseView: UIView = appKeyWindow.rootViewController!.view
        let viewControllerFrame: CGRect = appBaseView.convertRect(appBaseView.bounds, toView: appKeyWindow)
        
        let overwrapStatusBarHeight: CGFloat = statusBarHeight - viewControllerFrame.origin.y
        
        self.setNavigationBarOriginY(Float(overwrapStatusBarHeight), animated: animated)
    }
    
    func hideNavigationBar(animated: Bool) {
        let statusBarHeight: CGFloat = getStatusBarHeight()
        
        let appKeyWindow: UIWindow = UIApplication.sharedApplication().keyWindow!
        let appBaseView: UIView = appKeyWindow.rootViewController!.view
        let viewControllerFrame: CGRect = appBaseView.convertRect(appBaseView.bounds, toView: appKeyWindow)
        
        let overwrapStatusBarHeight: CGFloat = statusBarHeight - viewControllerFrame.origin.y
        
        let navigationBarHeight: CGFloat = navigationController!.navigationBar.frame.size.height
        let top: CGFloat = -navigationBarHeight
        
        self.setNavigationBarOriginY(Float(top), animated: animated)
    }
    
    func moveNavigationBar(deltaY: Float, animated: Bool) {
        let frame: CGRect = navigationController!.navigationBar.frame
        let nextY: CGFloat = frame.origin.y + CGFloat(deltaY)
        self.setNavigationBarOriginY(Float(nextY), animated: animated)
    }
    
    func setNavigationBarOriginY(y: Float, animated: Bool) {
        let statusBarHeight: CGFloat = getStatusBarHeight()
        
        let appKeyWindow: UIWindow = UIApplication.sharedApplication().keyWindow!
        let appBaseView: UIView = appKeyWindow.rootViewController!.view
        let viewControllerFrame: CGRect = appBaseView.convertRect(appBaseView.bounds, toView: appKeyWindow)
        
        let overwrapStatusBarHeight: CGFloat = statusBarHeight - viewControllerFrame.origin.y
        
        var frame = navigationController!.navigationBar.frame
        let navigationBarHeight = frame.size.height
        
        let topLimit: CGFloat = -navigationBarHeight
        let bottomLimit = overwrapStatusBarHeight
        
        frame.origin.y = CGFloat(min(max(CGFloat(y), topLimit), bottomLimit))
        
        let navBarHiddenRatio: CGFloat = overwrapStatusBarHeight > 0 ? (overwrapStatusBarHeight - frame.origin.y) / overwrapStatusBarHeight : 0
        let alpha: CGFloat = max(1.0 - navBarHiddenRatio, 0.000001)
        UIView.animateWithDuration(animated ? 0.1 : 0, animations: {[unowned self]() -> () in
            self.navigationController!.navigationBar.frame = frame
            var index: Int = 0
            for v in self.navigationController!.navigationBar.subviews {
                let navView = v as UIView
                index++

    func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
        forwardTarget?.scrollViewDidEndDragging!(scrollView, willDecelerate: decelerate)
        
        let currentOffsetY = Float(scrollView.contentOffset.y)
        let topBoundary = -Float(scrollView.contentInset.top)
        let bottomBoundary = Float(scrollView.contentSize.height + scrollView.contentInset.bottom)
        
        switch previousScrollDirection {
        case .Up:
