txt-bidi

Installation
SKILL.md

Bidirectional Text and RTL

Authored against iOS 26.x / Swift 6.x / Xcode 26.x.

Bidi correctness is layered. SwiftUI's environment, NSParagraphStyle, the .writingDirection attribute, UITextInput, and NSTextContainer each control direction at a different scope; getting RTL right usually means getting the right layer involved, not all of them. The single concept that explains most bidi bugs is the gap between logical order (how characters live in storage) and visual order (how they end up on screen after the Unicode Bidi Algorithm reorders them) — a single logical position can map to two visual positions at a direction boundary, which is why cursors appear to jump. The patterns below are starting points; before quoting any specific API signature, fetch the current Apple docs via Sosumi (sosumi.ai/documentation/uikit/uitextinput) and verify against the actual code, especially when the question involves cursor movement.

Stock UITextView and UITextField handle bidi correctly with .natural writing direction. Most "bidi is broken" reports against stock views turn out to be .left alignment hardcoded somewhere, or a phone number reordering because no LRM was added. Custom UITextInput views handle bidi only as well as their author writes it.

Contents

Direction control by layer

Installs
1
GitHub Stars
3
First Seen
Jun 16, 2026
txt-bidi — aibot88/sec_skill_store