LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

swift-formatstyle

Formats and parses locale-aware numbers, decimals, currencies, percentages, dates, durations, measurements, names, lists, byte counts, and URLs with Foundation FormatStyle and ParseableFormatStyle. Use when replacing legacy Formatter subclasses, designing reusable format APIs, using SwiftUI Text(_:format:), correcting availability, or testing user-facing formatted output across locales.

957stars48forksUpdated 8/3/2026
Developer Tools#ios#formatting#localization#swift#swiftui

Security Assessment

Safe(96/100)
Security Score96/100

About swift-formatstyle

swift-formatstyle is an engineering reference for using Foundation's type-safe FormatStyle and ParseableFormatStyle APIs to format and parse locale-aware values in Swift. It solves the common iOS problem of correctly displaying and round-tripping numbers, decimals, currencies, percentages, dates, durations, measurements, person names, lists, byte counts, and URLs across locales — replacing legacy Formatter subclasses like NumberFormatter and DateFormatter and error-prone manual string interpolation.

The skill provides a workflow (identify the value's semantic type, pick the narrowest built-in style, render against representative locales such as en_US, de_DE, ar_SA, and ja_JP, and check separators, numbering systems, calendars, currency/unit conventions, and text direction), plus a quick-reference table mapping each value type to its default style and key constraints. It documents availability gates (Duration and URL format styles require iOS 16+, Date.AnchoredRelativeFormatStyle requires iOS 18+), SwiftUI integration via Text(_:format:), parsing with ParseableFormatStyle, and building custom format styles. A bundled formatstyle-recipes.md reference gives concrete modifiers for precision, rounding, grouping, notation, currency codes, date intervals, relative dates, durations, measurements, names, lists, byte counts, and URL component controls; it also cautions that URL formatting is display formatting, not sanitization or a security boundary. Localization concerns like String Catalogs, plurals, and RTL layout are routed to a separate ios-localization skill.

It targets Swift and iOS developers modernizing formatting code, designing reusable format APIs, and testing user-facing output across locales.

FAQ

What problem does this skill solve?

It guides use of Foundation's FormatStyle/ParseableFormatStyle for locale-aware display and parsing, replacing legacy Formatter subclasses and manual interpolation for new iOS 15+ code.

Which value types are covered?

Numbers, decimals, currencies, percentages, dates, durations, measurements, person names, lists, byte counts, and URLs, each with a default style and important constraints.

Are there iOS availability constraints?

Yes. Duration format styles and URL.FormatStyle require iOS 16+, and Date.AnchoredRelativeFormatStyle requires iOS 18+; the skill flags these so you correct availability.

Should I set a fixed locale?

Only for an explicit protocol/wire format or a test fixture. For normal UI, omit .locale(...) so the style inherits the user's locale, and test round trips across representative locales.

Can I rely on URL formatting for security?

No. The recipes reference explicitly says to treat URL.FormatStyle as display formatting, not URL sanitization or a security boundary.

All Files

3 files
evals/evals.json3.4 KB
View
references/formatstyle-recipes.md4.2 KB
View
SKILL.md7.7 KB
View

Install swift-formatstyle

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

dpearson2699/swift-ios-skills

Related Skills

dbt-sf-to-bq-translator

21,076

build-models

102

html-prototype

3,588

doc

448