Build native RTL support for Swift interfaces
Define the outcome
Make every in-scope flow feel native in both left-to-right and right-to-left
contexts. Preserve semantic reading order, physical meaning, text integrity,
localized formatting, asset intent, interaction direction, and typography.
Treat a clean build or a mirrored screenshot as partial evidence. Completion
requires representative real-language content and interaction testing.
Read references selectively
- Read
references/methodology.md before planning an audit, classifying a
component, changing code, or deciding whether evidence proves completion.
- Read
references/layout-and-navigation.md for semantic geometry, custom
layouts, navigation, paging, gestures, transitions, collections, and charts.
- Read
references/text-and-formatting.md for String Catalogs, interpolation,
bidi text, writing direction, formatting, text editing, and identifiers.
- Read
references/swiftui-and-uikit.md before implementing or reviewing
framework-specific APIs and availability-sensitive behavior.
- Read
references/assets-and-typography.md for images, SF Symbols, custom
shapes, Arabic and Hebrew typography, and directional artwork.
- Read
references/testing-and-evidence.md before previews, scheme testing,
UI tests, screenshots, linguistic QA, or completion reporting.
- Read
references/sources.md when a claim is version-sensitive, disputed, or
needs a primary Apple, Unicode, or W3C source.
Repository instructions, supported deployment targets, selected SDK behavior,
and explicit user scope override generic examples. They never weaken the
real-language, bidi-integrity, or truthful-evidence gates.
Route the request
Choose one lead mode:
- Explain or design: define semantic direction and tradeoffs; do not edit.
- Audit or review: inspect code and behavior, then report prioritized,
evidence-backed findings without implementing unless requested.
- Implement or fix: inspect the available baseline, make the smallest
complete correction, and verify it proportionally.
- Diagnose: reproduce the RTL-only failure and identify its semantic,
localization, text-system, asset, or interaction root cause.
- Test: build a locale and device matrix, run it, and report exact evidence.
Do not infer permission to translate production copy, redesign unrelated UI,
publish a build, or certify every supported language.
In Implement or fix mode, apply a source-evident, semantically classified
correction without waiting for a build, Simulator, or physical device. Run the
available LTR/RTL checks afterward and report runtime verification pending
instead of leaving the correction as advice.
Establish the RTL contract
- Read repository instructions and inspect version-control status.
- Record the Xcode and SDK versions, deployment targets, UI framework
boundaries, supported languages and regions, devices, size classes, and
affected user journeys.
- Inventory user-visible strings, dynamic values, editable or remote text,
assets, custom drawing, custom layouts, navigation, gestures, paging,
animations, charts, playback, and spatial controls.
- Classify each horizontal behavior as reading-flow, spatial,
playback, time or calendar based, content image, or
directional asset. Default ordinary interface flow to reading-flow;
require evidence for an exception.
- Define acceptance for layout, text, assets, formatting, interactions,
typography, and testing before editing.
Keep three concepts separate:
- Interface layout direction controls semantic leading and trailing order.
- Paragraph writing direction controls directional runs and base direction.
- Text alignment controls where laid-out lines sit inside their container.
Do not derive all three from the selected app language. Current SDK behavior,
the string's content, explicit paragraph attributes, and component semantics
can resolve them differently.
Implement semantic layout
- Prefer standard SwiftUI and UIKit components and let them adapt naturally.
- Use
leading and trailing for reading-flow geometry. Keep left and
right only for intentionally physical sides.
- Scope any
layoutDirection override or semanticContentAttribute to the
smallest spatial or playback component that requires it.
- Inspect custom
Layout, manual coordinates, offsets, Canvas drawing,
collection layouts, snapping, page indicators, drag thresholds, transition
edges, and animation signs explicitly.
- Preserve the system behavior of navigation controllers, lists, collections,
page controllers, and standard controls unless a reproduced defect proves an
override is necessary.
Never mirror a complete screen with scaleEffect(x: -1) or an equivalent view
transform. It reverses text, artwork, physical symbols, and input behavior.
Preserve text and locale semantics
- Keep text in logical storage order; never reverse strings or reorder scalars.
- Use localizable whole messages and translator-controlled placeholders. Do
not concatenate localized fragments or manually pluralize.
- Use Foundation formatters and
FormatStyle for numbers, percentages,
currency, dates, times, lists, names, and measurements. Do not append symbols
or units manually.
- Prefer system text layout and natural or content-aware direction. Add
paragraph direction or Unicode isolation only after diagnosing a concrete
mixed-direction case.
- Treat locale and language as separate inputs. Test regional preferences for
digits, calendars, separators, currencies, and units.
- Preserve TextKit 2 and multi-range selection for editable bidi text where the
selected SDK supports Natural Selection.
Decide every asset deliberately
For each image or symbol, first choose exactly one direction policy:
- Fixed because it is content, a logo, or a physical direction;
- Mirrors because a mechanical flip safely follows reading flow;
- Both because purpose-built LTR and RTL renditions are required.
Then decide independently whether the asset also needs language- or
region-localized variants.
Use semantic SF Symbol names such as forward and backward for reading flow,
and physical left or right names only for absolute direction. Verify Arabic
joining, diacritics, line height, tracking, fallback fonts, emphasis, and
localized symbol variants; verify Hebrew independently rather than treating all
RTL scripts as Arabic.
Verify the minimum matrix
Run both Right-to-Left Pseudolanguage modes available in the selected Xcode, then
test every supported RTL localization with representative real-language
content. For a reusable component or general RTL-readiness claim, also include
real Arabic and real Hebrew developer fixtures even when the product does not
ship full localizations for both. Cross each claimed language with relevant
regional preferences.
Include mixed RTL and LTR text, digits, punctuation, parentheses, user names,
URLs, empty and error states, long strings, Dynamic Type, portrait and
landscape, compact and regular widths, and every directional gesture,
transition, carousel, pager, image, symbol, chart, and playback control.
Use previews and static screenshots for breadth, UI tests for interaction
regressions, and simulated or physical devices for final behavior. Require a
qualified native-speaker review for every claimed language and relevant region.
Apply hard guardrails
- Do not globally force
.rightToLeft or .leftToRight to patch one component.
- Do not replace semantic anchors mechanically without checking physical intent.
- Do not assume all images, charts, arrows, timelines, or numbers share one
mirroring policy.
- Do not hard-code Arabic-Indic or Western digits from the UI language.
- Do not use legacy bidi embeddings or marks as the first repair.
- Do not claim RTL readiness from pseudolocalization alone.
- Do not claim linguistic correctness without qualified human review.
Report completion
State the selected mode, SDK and deployment baseline, locales and regions,
component classifications, changed or reviewed files, validation commands,
devices and configurations, real-language and bidi cases, interaction checks,
linguistic review, and remaining risks.
Use “implemented; RTL device verification pending” when device evidence is
missing. Reserve “RTL-ready for the in-scope flows” for a successful minimum
matrix across every claimed RTL localization. Require Arabic and Hebrew
fixtures as an additional gate only for reusable or general RTL-support claims,
and scope every claim to what was actually tested.
1---2name: swift-rtl-support3description: Use when planning, designing, implementing, debugging, auditing, reviewing, or testing right-to-left support in SwiftUI, UIKit, or mixed iOS and iPadOS apps. Trigger for RTL or right-to-left layout, Arabic, Hebrew, Persian, Urdu, bidirectional or bidi text, layoutDirection, writing direction, semanticContentAttribute, leading and trailing constraints, mirrored navigation or gestures, localized assets and SF Symbols, locale-aware numbers or dates, custom collection layouts, and RTL regression testing. Use for both new features and existing-screen audits; do not treat translation alone or a global horizontal flip as complete RTL support.4---56# Build native RTL support for Swift interfaces78## Define the outcome910Make every in-scope flow feel native in both left-to-right and right-to-left11contexts. Preserve semantic reading order, physical meaning, text integrity,12localized formatting, asset intent, interaction direction, and typography.1314Treat a clean build or a mirrored screenshot as partial evidence. Completion15requires representative real-language content and interaction testing.1617## Read references selectively1819- Read `references/methodology.md` before planning an audit, classifying a20 component, changing code, or deciding whether evidence proves completion.21- Read `references/layout-and-navigation.md` for semantic geometry, custom22 layouts, navigation, paging, gestures, transitions, collections, and charts.23- Read `references/text-and-formatting.md` for String Catalogs, interpolation,24 bidi text, writing direction, formatting, text editing, and identifiers.25- Read `references/swiftui-and-uikit.md` before implementing or reviewing26 framework-specific APIs and availability-sensitive behavior.27- Read `references/assets-and-typography.md` for images, SF Symbols, custom28 shapes, Arabic and Hebrew typography, and directional artwork.29- Read `references/testing-and-evidence.md` before previews, scheme testing,30 UI tests, screenshots, linguistic QA, or completion reporting.31- Read `references/sources.md` when a claim is version-sensitive, disputed, or32 needs a primary Apple, Unicode, or W3C source.3334Repository instructions, supported deployment targets, selected SDK behavior,35and explicit user scope override generic examples. They never weaken the36real-language, bidi-integrity, or truthful-evidence gates.3738## Route the request3940Choose one lead mode:4142- **Explain or design**: define semantic direction and tradeoffs; do not edit.43- **Audit or review**: inspect code and behavior, then report prioritized,44 evidence-backed findings without implementing unless requested.45- **Implement or fix**: inspect the available baseline, make the smallest46 complete correction, and verify it proportionally.47- **Diagnose**: reproduce the RTL-only failure and identify its semantic,48 localization, text-system, asset, or interaction root cause.49- **Test**: build a locale and device matrix, run it, and report exact evidence.5051Do not infer permission to translate production copy, redesign unrelated UI,52publish a build, or certify every supported language.5354In Implement or fix mode, apply a source-evident, semantically classified55correction without waiting for a build, Simulator, or physical device. Run the56available LTR/RTL checks afterward and report runtime verification pending57instead of leaving the correction as advice.5859## Establish the RTL contract60611. Read repository instructions and inspect version-control status.622. Record the Xcode and SDK versions, deployment targets, UI framework63 boundaries, supported languages and regions, devices, size classes, and64 affected user journeys.653. Inventory user-visible strings, dynamic values, editable or remote text,66 assets, custom drawing, custom layouts, navigation, gestures, paging,67 animations, charts, playback, and spatial controls.684. Classify each horizontal behavior as **reading-flow**, **spatial**,69 **playback**, **time or calendar based**, **content image**, or70 **directional asset**. Default ordinary interface flow to reading-flow;71 require evidence for an exception.725. Define acceptance for layout, text, assets, formatting, interactions,73 typography, and testing before editing.7475Keep three concepts separate:7677- **Interface layout direction** controls semantic leading and trailing order.78- **Paragraph writing direction** controls directional runs and base direction.79- **Text alignment** controls where laid-out lines sit inside their container.8081Do not derive all three from the selected app language. Current SDK behavior,82the string's content, explicit paragraph attributes, and component semantics83can resolve them differently.8485## Implement semantic layout8687- Prefer standard SwiftUI and UIKit components and let them adapt naturally.88- Use `leading` and `trailing` for reading-flow geometry. Keep `left` and89 `right` only for intentionally physical sides.90- Scope any `layoutDirection` override or `semanticContentAttribute` to the91 smallest spatial or playback component that requires it.92- Inspect custom `Layout`, manual coordinates, offsets, Canvas drawing,93 collection layouts, snapping, page indicators, drag thresholds, transition94 edges, and animation signs explicitly.95- Preserve the system behavior of navigation controllers, lists, collections,96 page controllers, and standard controls unless a reproduced defect proves an97 override is necessary.9899Never mirror a complete screen with `scaleEffect(x: -1)` or an equivalent view100transform. It reverses text, artwork, physical symbols, and input behavior.101102## Preserve text and locale semantics103104- Keep text in logical storage order; never reverse strings or reorder scalars.105- Use localizable whole messages and translator-controlled placeholders. Do106 not concatenate localized fragments or manually pluralize.107- Use Foundation formatters and `FormatStyle` for numbers, percentages,108 currency, dates, times, lists, names, and measurements. Do not append symbols109 or units manually.110- Prefer system text layout and natural or content-aware direction. Add111 paragraph direction or Unicode isolation only after diagnosing a concrete112 mixed-direction case.113- Treat locale and language as separate inputs. Test regional preferences for114 digits, calendars, separators, currencies, and units.115- Preserve TextKit 2 and multi-range selection for editable bidi text where the116 selected SDK supports Natural Selection.117118## Decide every asset deliberately119120For each image or symbol, first choose exactly one direction policy:121122- **Fixed** because it is content, a logo, or a physical direction;123- **Mirrors** because a mechanical flip safely follows reading flow;124- **Both** because purpose-built LTR and RTL renditions are required.125126Then decide independently whether the asset also needs language- or127region-localized variants.128129Use semantic SF Symbol names such as `forward` and `backward` for reading flow,130and physical `left` or `right` names only for absolute direction. Verify Arabic131joining, diacritics, line height, tracking, fallback fonts, emphasis, and132localized symbol variants; verify Hebrew independently rather than treating all133RTL scripts as Arabic.134135## Verify the minimum matrix136137Run both Right-to-Left Pseudolanguage modes available in the selected Xcode, then138test every supported RTL localization with representative real-language139content. For a reusable component or general RTL-readiness claim, also include140real Arabic and real Hebrew developer fixtures even when the product does not141ship full localizations for both. Cross each claimed language with relevant142regional preferences.143144Include mixed RTL and LTR text, digits, punctuation, parentheses, user names,145URLs, empty and error states, long strings, Dynamic Type, portrait and146landscape, compact and regular widths, and every directional gesture,147transition, carousel, pager, image, symbol, chart, and playback control.148149Use previews and static screenshots for breadth, UI tests for interaction150regressions, and simulated or physical devices for final behavior. Require a151qualified native-speaker review for every claimed language and relevant region.152153## Apply hard guardrails154155- Do not globally force `.rightToLeft` or `.leftToRight` to patch one component.156- Do not replace semantic anchors mechanically without checking physical intent.157- Do not assume all images, charts, arrows, timelines, or numbers share one158 mirroring policy.159- Do not hard-code Arabic-Indic or Western digits from the UI language.160- Do not use legacy bidi embeddings or marks as the first repair.161- Do not claim RTL readiness from pseudolocalization alone.162- Do not claim linguistic correctness without qualified human review.163164## Report completion165166State the selected mode, SDK and deployment baseline, locales and regions,167component classifications, changed or reviewed files, validation commands,168devices and configurations, real-language and bidi cases, interaction checks,169linguistic review, and remaining risks.170171Use “implemented; RTL device verification pending” when device evidence is172missing. Reserve “RTL-ready for the in-scope flows” for a successful minimum173matrix across every claimed RTL localization. Require Arabic and Hebrew174fixtures as an additional gate only for reusable or general RTL-support claims,175and scope every claim to what was actually tested.