         v.isDoubleSided = false
         
         for view in v.view.subviews {
-            if view.isKind(of: UIScrollView.self) {
-                (view as? UIScrollView)?.delegate = self
+            if let v = view as? UIScrollView {
+                v.delegate = self
             }
         }
     }

}

extension PageTabBarController: UIPageViewControllerDelegate {
    public func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {
        guard let vc = pendingViewControllers.first else {
            return
        }
        
        guard let index = viewControllers.index(of: vc) else {
            return
        }
        
        selectedIndex = index
    }
    
    public func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
        
        guard completed else {
            return
        }
        
        pageTabBar.select(at: selectedIndex)
    }
}

        }
        
        let next = current + 1
        
        guard viewControllers.count > next else {
            return nil
        }
        
