         }
     }
     
+    private func updateContentOffset(withIndex index: Int) {
+        if viewControllers.count > index {
+            let width = viewControllers[index].view.bounds.width
+            let contentOffsetX = width * CGFloat(index)
+            setContentOffset(CGPoint(x: contentOffsetX, y: contentOffset.y), animated: true)
+        }
+    }
+    
     func hideContent(forRange range: Range<Int>) {
         viewControllers.enumerate().forEach { index, viewController in
             viewController.view.hidden = range.contains(index)

        }
        
        layoutContent()
    }
    
}

        let first = min(index, indexOfVisibleItem) + 1
        let last = max(index, indexOfVisibleItem)
        hideContent(forRange: first..<last)
        updateContentOffset(withIndex: index)
    }
 
    public func reloadData() {
