AurumRollingNumber
A number that rolls to its value instead of appearing at it.
| family | Text |
|---|---|
| platform | iOS 17+ · SwiftUI |
| source | Sources/Aurum/Component/Text/AurumRollingNumber.swift |
A number that rolls to its value instead of appearing at it.
On first appearance it lands on easingGlide — nearly all of the distance in the first
half of the time, then the last few units crawling to rest — over a duration set by pace,
starting from zero or, with landFromFraction, from just below the value so it arrives
rather than spins up. Later changes to value roll from the current figure on
easingDecelerate, up or down to match the direction of the change, with each digit
sliding into place via numericText. When the roll settles it gives a select tick and a 1.5 % scale bump on
springFastSpatial. Honours Reduce Motion — it then shows the final value with no roll,
no bump and no tick — and reads to VoiceOver as the final figure once.
Aurum never decides how a number is written. format is the caller's: currency symbol,
grouping, fraction digits and units come from the same place the surrounding copy does.
Mirrors aurum-android's AurumRollingNumber.
Intended use
Use for the one figure a surface exists to show — a hero amount on a receipt, a locker balance, a total that just changed because of something the user did.
Do
- Pass
formatfrom the same helper that formats the static copy around it, so the rolling figure and its neighbours never disagree on grouping or symbol. - Use it once per surface. One rolling figure is emphasis; two compete and neither reads.
Don’t
- Put it in list rows or repeat it down a column — a screen of rolling numbers is noise. Rows want
AurumText. - Feed it a value you will not change and do not want to land — pass
landOnAppear: falseand it is a plainAurumTextwith a stable API.