Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Reviews, improves, and writes SwiftUI code following state management, view composition, performance, and iOS 26+ Liquid Glass best practices.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/text-patterns.md
1# SwiftUI Text Patterns Reference23## Table of Contents45- [Text Initialization: Verbatim vs Localized](#text-initialization-verbatim-vs-localized)67## Text Initialization: Verbatim vs Localized89**Default: always use `Text("…")`.** Only use `Text(verbatim:)` when explicitly required for a string literal that must not be localized.1011```swift12// Localized literal - "Save" is used as the localization key and looked up in Localizable.strings (only if one exists in the project)13Text("Save")1415// String variable - bypasses localization automatically; no verbatim needed16let filename: String = model.exportFilename17Text(filename)1819// Non-localized literal - use verbatim only when the literal must not be localized20Text(verbatim: "pencil")21```2223### Decision Flow2425```26Is the input a String variable or dynamic value?27└─ YES → Text(variable) // bypasses localization automatically2829Is the string literal intended for localization?30├─ YES → Text("…") // default; key looked up in Localizable.strings31└─ NO → Text(verbatim: "…") // only when explicitly non-localized32```33