             return
         }
         
-        guard let index = tb.buttons.index(of: button) else {
-            return
-        }
-        
-        guard index != selectedIndex else {
-            return
-        }
-        
-        selectedIndex = index
+        guard let i = tb.buttons.index(of: button) else {
+            return
+        }
+        
+        guard i != selectedIndex else {
+            return
+        }
+        
+        selectedIndex = i
         
         removeViewControllers()
         prepareViewControllers()

}

open class TabMenuController: UIViewController {
    @IBInspectable
    open var selectedIndex = 0
    

    
    fileprivate func layoutViewControllers() {
        let n = viewControllers.count
        scrollView.contentSize = CGSize(width: scrollView.width * CGFloat(n), height: scrollView.height)
        
        guard 1 < n else {
            layoutViewController(at: 0, position: 0)
            return
        }
        
        let m = viewPoolCount < n ? viewPoolCount : n
        
        if 0 == selectedIndex {
            for i in 0..<m {
                layoutViewController(at: i, position: i)
            }
        } else if n - 1 == selectedIndex {
            var q = 0
            for i in 0..<m {
                q = selectedIndex - i
                layoutViewController(at: q, position: q)
            }
        } else {
            layoutViewController(at: selectedIndex, position: selectedIndex)
            layoutViewController(at: selectedIndex - 1, position: selectedIndex - 1)
            layoutViewController(at: selectedIndex + 1, position: selectedIndex + 1)
        }
    }
    
