Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Source/GestureControl/GestureControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public class GestureControl: UIView {
extension GestureControl {

@objc dynamic func swipeHandler(_ gesture: UISwipeGestureRecognizer) {
delegate.gestureControlDidSwipe(gesture.direction)
var direction = gesture.direction
let isRTL = UIView.userInterfaceLayoutDirection(for: gesture.view!.semanticContentAttribute) == .rightToLeft

// Flip direction only if in RTL interface
if (isRTL && direction == .right) {
direction = .left
} else if (isRTL && direction == .left) {
direction = .right
}

delegate.gestureControlDidSwipe(direction)
}
}
5 changes: 4 additions & 1 deletion Source/PageView/PageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ extension PageView {
}

let containerWidth = CGFloat(itemsCount + 1) * selectedItemRadius + space * CGFloat(itemsCount - 1)
let toValue = containerWidth / 2.0 - selectedItemRadius - (selectedItemRadius + space) * CGFloat(index)

let isRTL = UIView.userInterfaceLayoutDirection(for: self.semanticContentAttribute) == .rightToLeft
let sign: CGFloat = isRTL ? 1 : -1
let toValue = containerWidth / 2.0 + sign * (selectedItemRadius + (selectedItemRadius + space) * CGFloat(index))
containerX.constant = toValue

if animated == true {
Expand Down