             return
         }
         
-        setViewControllers([viewControllers[index]], direction: index < selectedIndex ? .reverse : .forward, animated: true) { [weak self, index = index] _ in
+        let direction: UIPageViewControllerNavigationDirection = index < selectedIndex ? .reverse : .forward
+        
+        isTabSelectedAnimation = true
+        selectedIndex = index
+        
+        setViewControllers([viewControllers[index]], direction: direction, animated: true) { [weak self] _ in
             guard let s = self else {
                 return
             }
-            s.selectedIndex = index
-            s.pageTabBar.select(at: index)
+            s.isTabSelectedAnimation = false
         }
     }
     

}

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
        }
        
