             containerView.bounds.origin.y = stickyHeight
         }
     }
+    
+    override func observeValue(forKeyPath keyPath: String?, of object: Any?,
+                               change: [NSKeyValueChangeKey : Any]?,
+                               context: UnsafeMutableRawPointer?) {
+        
+        if let obj = object as? UITableView,
+           obj == self.tableView &&
+            keyPath == "contentSize" {
+            var size = tableView.contentSize
+            size.height += (191 * 2 - stickyHeight + 44)
+            topScrollView.contentSize = size
+        }
+    }
 }
 
 extension NestedScrollViewVC: UITableViewDataSource {

    // https://stackoverflow.com/questions/13221488/uiscrollview-within-a-uiscrollview-how-to-keep-a-smooth-transition-when-scrolli
    override func viewDidLoad() {
        super.viewDidLoad()

        containerView.backgroundColor = .systemGreen
        
        view.addGestureRecognizer(tableView.panGestureRecognizer)
        tableView.removeGestureRecognizer(tableView.panGestureRecognizer)

        let bottom = view.safeAreaBottom
        containerView.addSubview(tableView)
        tableView.frame = CGRect(x: 0, y: top, width: view.frame.width, height: view.frame.height - top - bottom)
        
        tableView.addObserver(self,
                              forKeyPath: "contentSize",
                              options: .new,
                              context: nil)

        view.addSubview(topScrollView)
        topScrollView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)
        let scrollviewOrigin = topScrollView.frame.origin;
        topScrollView.scrollIndicatorInsets = UIEdgeInsets(top: -scrollviewOrigin.y, left: 0, bottom: scrollviewOrigin.y, right: scrollviewOrigin.x)

