AurumText

Aurum's canonical text primitive — the SwiftUI port of aurum-android's AurumText.

familyText
platformiOS 17+ · SwiftUI
sourceSources/Aurum/Component/Text/AurumText.swift
snapshots4 baselines · iPhone 17 Pro · iOS 26.5

Aurum's canonical text primitive — the SwiftUI port of aurum-android's AurumText.

Wraps SwiftUI.Text and applies Aurum typography tokens through .aurumType(_:) (custom Inter/Frank Ruhl with exact Figma line height and Dynamic Type scaling). If no style is provided, defaults to Aurum.type.bodyMRegular.

### Foreground resolution order (mirrors Android) 1. Explicit foreground: shape style — gradients and any ShapeStyle (the analogue of Android's style.brush channel). 2. Explicit color: parameter. 3. Aurum's default text colour (Aurum.colors.surface.textDefaultNormal).

AurumText never inherits the ambient foreground — like Android's, it always resolves to a concrete Aurum token unless told otherwise.

alignment and lineLimit are applied only when non-nil, so an outer .multilineTextAlignment(...) / .lineLimit(...) still flows through the environment when the parameters are left at their defaults.

Deliberate deviations from Android (platform idiom): - No minLines / overflow / onTextLayout — SwiftUI truncates with tail ellipsis at lineLimit and exposes no layout callback. - Per-span gradients (AnnotatedString brush spans) have no AttributedString equivalent; whole-text gradients use foreground:.

Intended use

Use as the canonical text primitive for any text rendered in feature code. Picks up Aurum typography + colour tokens by default so visual variants flow without per-call wiring, and keeps Dynamic Type scaling on the token's anchor curve.

Do

  • Set style: Aurum.type.<role> to anchor in the design system's typographic scale.
  • Pass color: from Aurum.colors.surface.text* tokens — never a raw Color(...) literal.
  • Cap multi-line copy with lineLimit: for predictable truncation in lists / cards.

Don’t

  • Use bare SwiftUI.Text with .font(...) in feature code; this is exactly what AurumText prevents.
  • Pass color: and foreground: together — foreground wins; pick one channel.
  • Apply .font(...) after an AurumText — that bypasses Aurum.type.* and is how typography drift starts.

Snapshots

Recorded on the pinned simulator — iPhone 17 Pro · iOS 26.5 · Xcode 26.6.

AurumText — ComponentSnapshotTests · testTextAlignmentAndLineLimit
ComponentSnapshotTests · testTextAlignmentAndLineLimit
AurumText — ComponentSnapshotTests · testTextAttributedRuns
ComponentSnapshotTests · testTextAttributedRuns
AurumText — ComponentSnapshotTests · testTextRoles
ComponentSnapshotTests · testTextRoles
AurumText — FieldSnapshotTests · testTextFieldStates
FieldSnapshotTests · testTextFieldStates