                       width: elementWidth,
                       height: height - totalInsetSize)
     }
-    private func nearestIndex(toPoint point: CGPoint) -> Int {
-        let distances = normalSegments.map { abs(point.x - $0.center.x) }
+    private func closestIndex(toPoint point: CGPoint) -> Int {
+        let distances = normalSegmentViews.map { abs(point.x - $0.center.x) }
         return Int(distances.firstIndex(of: distances.min()!)!)
     }
     private static func generateDefaultSegments() -> [LabelSegment] {

                           initialSpringVelocity: 0.0,
                           options: [.beginFromCurrentState, .curveEaseOut],
                           animations: { () -> Void in
                            self.indicatorView.frame = self.normalSegments[self.index].frame
                            self.layoutIfNeeded()
            }, completion: { finished -> Void in
                completion()

    
    private var width: CGFloat { bounds.width }
    private var height: CGFloat { bounds.height }
    
    private var normalSegmentViews: [UIView] { normalSegmentViewsContainerView.subviews }
    private var normalSegmentViewCount: Int { normalSegmentViews.count }
    
    /// `selectedSegmentViews` provide accessibility traits.
    private var selectedSegmentViews: [UIView] { selectedSegmentViewsContainerView.subviews }
    
    /// Contains normal segment views and selected segment views.
    private var allSegmentViews: [UIView] { normalSegmentViews + selectedSegmentViews }
    
    private var lastIndex: Int { segments.endIndex - 1 }
    
    private var totalInsetSize: CGFloat { indicatorViewInset * 2.0 }
    
    private var isLayoutDirectionRightToLeft: Bool {
        let layoutDirection = UIView.userInterfaceLayoutDirection(for: semanticContentAttribute)
        return layoutDirection == .rightToLeft
    }
    
    private static var defaultOptions: [Option] = [.backgroundColor(.appleSegmentedControlDefaultControlBackground),
                                                   .indicatorViewBackgroundColor(.appleSegmentedControlDefaultIndicatorBackground)]
    
