                     tab.imageView?.contentMode = .scaleAspectFit
                     tab.tintColor = i == selectedSegment ? highlightTint : tint
                 }
-                
+
                 tab.tag = i
                 tab.addTarget(self, action: #selector(XMSegmentedControl.segmentPressed(_:)), for: .touchUpInside)
                 self.addSubview(tab)

            addSegments(startingPosition: 0, sections: tabBarSections, width: sectionWidth, height: frame.height)
        } else if contentType == .icon {
            let tabBarSections:Int = segmentIcon.count
            let positionWidth = startingPositionAndWidth(totalWidth, distribution: itemWidthDistribution, segmentCount: tabBarSections, selectedIndex: selectedSegment)
            addHighlightView(startingPosition: positionWidth.startingPosition, width: positionWidth.sectionWidth)
            addSegments(startingPosition: positionWidth.startingPosition, sections: tabBarSections, width: positionWidth.sectionWidth, height: self.frame.height)
        } else if contentType == .hybrid {
            let tabBarSections:Int = segmentContent.text.count
            let positionWidth = startingPositionAndWidth(totalWidth, distribution: itemWidthDistribution, segmentCount: tabBarSections, selectedIndex: selectedSegment)
            addHighlightView(startingPosition: positionWidth.startingPosition, width: positionWidth.sectionWidth)
            addSegments(startingPosition: 0, sections: tabBarSections, width: positionWidth.sectionWidth, height: self.frame.height)
        } else if contentType == .hybridVertical {
            let tabBarSections:Int = segmentContent.text.count
            let positionWidth = startingPositionAndWidth(totalWidth, distribution: itemWidthDistribution, segmentCount: tabBarSections, selectedIndex: selectedSegment)
            addHighlightView(startingPosition: positionWidth.startingPosition, width: positionWidth.sectionWidth)
            addSegments(startingPosition: positionWidth.startingPosition, sections: tabBarSections, width: positionWidth.sectionWidth, height: self.frame.height)
        }
    }

        (subviews as [UIView]).forEach { $0.removeFromSuperview() }
        let totalWidth = frame.width

        func startingPositionAndWidth(_ totalWidth: CGFloat, distribution: XMSegmentItemWidthDistribution, segmentCount: Int) -> (startingPosition: CGFloat, sectionWidth: CGFloat) {
            switch distribution {
            case .fixed:
                let width = totalWidth / 6
