     /// The number of views used in the scrollViewPool.
     fileprivate let viewPoolCount = 3
     
+    /// The last scroll view offset position.
+    fileprivate var scrollViewDirection = 0
+    
     /**
      An initializer that initializes the object with a NSCoder object.
      - Parameter aDecoder: A NSCoder instance.
      */
     public required init?(coder aDecoder: NSCoder) {
         viewControllers = []
-        selectedIndex = 0
         super.init(coder: aDecoder)
     }
     

            }
        } else if viewControllers.count - 1 == selectedIndex {
            for i in 0..<count {
                let j = count - i - 1
                layoutViewController(at: j, position: j)
            }
        } else {
            layoutViewController(at: selectedIndex, position: 1)
            layoutViewController(at: selectedIndex - 1, position: 0)
            layoutViewController(at: selectedIndex + 1, position: 2)
        }
    }
    

            v.removeTarget(self, action: #selector(handleTabBarButton(button:)), for: .touchUpInside)
            v.addTarget(self, action: #selector(handleTabBarButton(button:)), for: .touchUpInside)
        }
    }
    
    fileprivate func prepareTabBar() {
        guard 0 < viewControllers.count else {
            tabBar = nil
            return
        }
        
