         let itemWitdh = segmentioItems.enumerated().map { (index, _) -> CGFloat in
             return segmentWidth(for: IndexPath(item: index, section: 0))
         }
+        
+        var isRTL = false
+        if #available(iOS 9.0, *) {
+            isRTL = UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .rightToLeft
+        } else {
+            // Use the previous technique
+            isRTL = UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft
+        }
+        
         if let indicatorLayer = indicatorLayer, let options = segmentioOptions.indicatorOptions {
             let item = itemInSuperview(ratio: options.ratio)
 

                allItemsCellWidth: itemWitdh,
                pointY: indicatorPointY(),
                position: segmentioOptions.segmentPosition,
                style: segmentioStyle
            )
            let insetX = ((points.endPoint.x - points.startPoint.x) - (item.endX - item.startX))/2
            moveShapeLayer(

        // Cell will try to position itself in the middle, unless it can't because
        // the collection view has reached the beginning or end
        startX = (item.collectionViewWidth / 2) - (cellWidth / 2 )
        
        var isFixedPosition = false
        if case .fixed = position {
            isFixedPosition = true
        }
        
        if spaceBefore < (item.collectionViewWidth - cellWidth) / 2 {
            startX = isFixedPosition && isRTL ? item.collectionViewWidth - spaceBefore - cellWidth : spaceBefore
        }
        if spaceAfter < (item.collectionViewWidth - cellWidth) / 2 {
            startX = isFixedPosition && isRTL ? spaceAfter : item.collectionViewWidth - spaceAfter - cellWidth
        }
        endX = startX + cellWidth
        
