The SwipeActions library currently does not support right-to-left (RTL) languages such as Arabic, Hebrew, or Persian. This limits the usability of the library in applications that require RTL support, particularly in regions where these languages are predominant.
Current Behavior:
Swipe actions only support left-to-right (LTR) configurations.
RTL languages display swipe actions in the same direction as LTR, which can be confusing for users expecting standard RTL behavior.
Expected Behavior:
The library should automatically adjust swipe directions based on the device's locale settings.
For RTL languages, the swipe actions should be mirrored to match the expected interaction patterns, with primary actions swiping from the right and secondary actions from the left.
Steps to Reproduce:
Set your iOS device language to Arabic (or another RTL language).
Implement SwipeActions in a SwiftUI view.
Observe the swipe direction and layout.
Example Code:
struct ContentView: View {
var body: some View {
List {
ForEach(0..<5) { index in
Text("Item \(index)")
.swipeActions {
Button("Delete") {
print("Item deleted")
}
.tint(.red)
}
}
}
.environment(\.layoutDirection, .rightToLeft) // Force RTL for testing
}
}
Proposed Solution:
Add support for detecting and adapting to the device's layout direction using SwiftUI's .environment(.layoutDirection, .rightToLeft) modifier.
Implement conditional logic in the swipe action handling to adjust swipe directions for RTL languages.
Providing RTL support will enhance the library's accessibility and user experience for a broader audience, aligning with iOS's built-in RTL support capabilities.
The SwipeActions library currently does not support right-to-left (RTL) languages such as Arabic, Hebrew, or Persian. This limits the usability of the library in applications that require RTL support, particularly in regions where these languages are predominant.
Current Behavior: Swipe actions only support left-to-right (LTR) configurations. RTL languages display swipe actions in the same direction as LTR, which can be confusing for users expecting standard RTL behavior.
Expected Behavior: The library should automatically adjust swipe directions based on the device's locale settings. For RTL languages, the swipe actions should be mirrored to match the expected interaction patterns, with primary actions swiping from the right and secondary actions from the left. Steps to Reproduce:
Set your iOS device language to Arabic (or another RTL language). Implement SwipeActions in a SwiftUI view. Observe the swipe direction and layout. Example Code:
Proposed Solution:
Add support for detecting and adapting to the device's layout direction using SwiftUI's .environment(.layoutDirection, .rightToLeft) modifier.
Implement conditional logic in the swipe action handling to adjust swipe directions for RTL languages.
Providing RTL support will enhance the library's accessibility and user experience for a broader audience, aligning with iOS's built-in RTL support capabilities.