BarrettJ BarrettJ - 4 months ago 52x
iOS Question

iOS: Determine if device language is Right to Left (RTL)

Is there a way to easily determine if the language the device is set to is right to left (RTL)?


In iOS 9 one can determine the current direction for each individual view.

if #available(iOS 9.0, *) {
  if UIView.userInterfaceLayoutDirection(
    for: myView.semanticContentAttribute) == .rightToLeft {

      // The view is shown in right-to-left mode right now.
} else { /* Use the previous technique */ }

This is the recommended way of determining the layout direction in iOS 9.

WWDC 2015 video New UIKit Support for International User Interfaces. After minute 31:20.