import SwiftUI /// Short numeric transitions follow the owner-supplied motion policy. struct AnimatedMetricText: View { let value: String @Environment(\.metricAnimationsEnabled) private var animates var body: some View { if animates { RollingMetricText(value: value).equatable() } else { Text(verbatim: value).monospacedDigit() } } } /// Same numeric roll/blur and spring as the original implementation. Unchanged values /// do not rebuild this subtree when the surrounding resource snapshot changes. private struct RollingMetricText: View, Equatable { let value: String var body: some View { Text(verbatim: value).monospacedDigit() .contentTransition(.numericText()) .animation(.spring(duration: 0.35, bounce: 0), value: value) } } struct PanelCardBackground: ViewModifier { let radius: CGFloat func body(content: Content) -> some View { content.background(RoundedRectangle(cornerRadius: radius).fill(Color("PanelCard"))) } }