SwiftUI's Text view applies the same font to both the value and unit of a formatted measurement. Using the AttributedString API and the transformingAttributes method, you can build a reusable Text initializer that targets only the unit component and applies a distinct font. The approach lets you style the measurement value with standard text modifiers while keeping the unit visually subdued, and you can use the narrow width format to fix spacing issues when the unit font is smaller than the value font.
1 Impression