 }
 
 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 {
+    public func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
+        guard let v = pageViewController.viewControllers?.first else {
+            return
+        }
+        
+        guard let index = viewControllers.index(of: v) 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
        let count = viewControllers.count
        
        guard count != next, count > next else {
            return nil
        }
        

        v.isDoubleSided = false
        
        for view in v.view.subviews {
            if let v = view as? UIScrollView {
                v.delegate = self
            }
        }
    }
