     
     func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
         outerDeceleration = ScrollingDeceleration(velocity: velocity, decelerationRate: scrollView.decelerationRate)
-    }
-    
-    func scrollViewDidScroll(_ scrollView: UIScrollView) {
         if let deceleration = outerDeceleration {
             nested?.decelerator.decelerate(by: deceleration)
         }
+    }
+    
+    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
+        
+    }
+
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        
     }
     
     func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {

    }()

    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        print(scrollView.value(forKey: "_verticalVelocity"))
        decelerator.invalidateIfNeeded()
    }
}

}

final class NestedScrollViewVC: UIViewController {
    private lazy var outerScrollView: OuterScrollView = {
        let outer = OuterScrollView()
        outer.backgroundColor = .systemGray
        return outer
    }()
    
    private lazy var nestedScrollView: NestedScrollView = {
        let nested = NestedScrollView()
        nested.backgroundColor = .systemBlue
        return nested
    }()
