SKILL.md
Swift FormatStyle
Use Foundation's type-safe FormatStyle APIs for user-facing display and ParseableFormatStyle when the same convention must accept input. Route String Catalogs, plurals, localized copy, bundles, and RTL layout to ios-localization; formatting still requires locale review even when no text is translated.
Contents
- Workflow
- Quick Reference
- Selection and Availability
- Parsing
- SwiftUI Integration
- Custom FormatStyle
- Common Mistakes
- Review Checklist
- References
Workflow
- Identify the value's semantic type and whether output is display-only or must round-trip through parsing.
- Select the narrowest built-in style and keep the user's current locale unless a wire format explicitly requires another locale.
- Render the exact UI with representative locales such as
en_US,de_DE,ar_SA, andja_JP. - Check separators, numbering systems, calendars, currency and unit conventions, text direction, and layout.
- If output or parsing fails, fix the style or surrounding copy, restore the input fixture, and rerun the same locale matrix.
Load FormatStyle Recipes when implementation needs concrete modifiers, date intervals, relative dates, duration patterns, measurements, names, lists, byte counts, or URL component controls.
