Text

Tips tagged Text.

Automatic plurals with inflect: true

Text("^[\(count) item](inflect: true)") picks "1 item" or "2 items" for you, with no if statements and no plural rules of your own.

18 November 2026 · Text and localization

Format dates the reader's way with Date.FormatStyle

Ask for the date fields you want and let the locale decide the order, separators and 12 or 24-hour clock. No more dateFormat strings.

18 November 2026 · Formatting

Stop using String(format:) for money

Text(price, format: .currency(code:)) formats money for the reader's locale: symbol, separators and decimals included.

18 November 2026 · Formatting

"5 minutes ago" and live countdowns in SwiftUI

Text can show relative dates and run timers by itself. No Timer, no publishers, no string building.

18 November 2026 · Formatting