0Pricing
Swift Academy · Lesson

Right-to-Left and Layout Direction

Support RTL languages and mirrored layouts.

Languages That Read Right-to-Left

Arabic, Hebrew, Persian, and Urdu are written right-to-left (RTL). For these users the entire interface should mirror: navigation back buttons point right, lists align to the right edge, and progress flows from right to left. Supporting RTL is a core part of internationalization.

// RTL locales include: ar, he, fa, ur
// The whole UI mirrors, not just the text.

Leading and Trailing, Not Left and Right

The golden rule: design with leading and trailing instead of left and right. Leading is where reading starts (left in English, right in Arabic). When you use leading/trailing, the system mirrors your layout for free in RTL.

// SwiftUI uses leading/trailing automatically:
// HStack { Image(...); Text("Title") }
// .padding(.leading, 16)  // flips in RTL
let edge = "leading mirrors automatically"
_ = edge

All lessons in this course

  1. String Catalogs and Localized Strings
  2. Pluralization and Stringsdict
  3. Locale-Aware Formatting
  4. Right-to-Left and Layout Direction
← Back to Swift Academy