numericText(value:)
Creates a content transition intended to be used with Text views displaying numbers.
Declaration
static func numericText(value: Double) -> ContentTransitionParameters
- value:
The value represented by the
Textview being animated. The difference between the old and new values when the text changes will be used to determine the animation direction.
Return Value
A new content transition.
Discussion
The example below creates a text view displaying a particular value, assigning the same value to the associated transition:
Text("\(value)")
.contentTransition(.numericText(value: value))