AurumText
Aurum's canonical text primitive — the SwiftUI port of aurum-android's AurumText.
| family | Text |
|---|---|
| platform | iOS 17+ · SwiftUI |
| source | Sources/Aurum/Component/Text/AurumText.swift |
| snapshots | 4 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:fromAurum.colors.surface.text*tokens — never a rawColor(...)literal. - Cap multi-line copy with
lineLimit:for predictable truncation in lists / cards.
Don’t
- Use bare
SwiftUI.Textwith.font(...)in feature code; this is exactly whatAurumTextprevents. - Pass
color:andforeground:together —foregroundwins; pick one channel. - Apply
.font(...)after anAurumText— that bypassesAurum.type.*and is how typography drift starts.
Snapshots
Recorded on the pinned simulator — iPhone 17 Pro · iOS 26.5 · Xcode 26.6.