---
title: monospacedDigit()
framework: swiftui
role: symbol
role_heading: Instance Method
path: swiftui/text/monospaceddigit()
---

# monospacedDigit()

Modifies the text view’s font to use fixed-width digits, while leaving other characters proportionally spaced.

## Declaration

```swift
nonisolated func monospacedDigit() -> Text
```

## Return Value

Return Value A text view with a modified font that uses fixed-width numeric characters, while leaving other characters proportionally spaced.

## Discussion

Discussion This modifier only affects numeric characters, and leaves all other characters unchanged. The following example shows the effect of monospacedDigit() on a text view. It arranges two text views in a VStack, each displaying a formatted date that contains many instances of the character 1. The second text view uses the monospacedDigit(). Because 1 is usually a narrow character in proportional fonts, applying the modifier widens all of the 1s, and the text view as a whole. The non-digit characters in the text view remain unaffected. let myDate = DateComponents(     calendar: Calendar(identifier: .gregorian),     timeZone: TimeZone(identifier: "EST"),     year: 2011,     month: 1,     day: 11,     hour: 11,     minute: 11 ).date!

var body: some View {     VStack(alignment: .leading) {         Text(myDate.formatted(date: .long, time: .complete))             .font(.system(size: 20))         Text(myDate.formatted(date: .long, time: .complete))             .font(.system(size: 20))             .monospacedDigit()     }     .padding()     .navigationTitle("monospacedDigit() Modifier") }

If the base font of the text view doesn’t support fixed-width digits, the font remains unchanged.

## See Also

### Styling the view’s text

- [foregroundStyle(_:)](swiftui/text/foregroundstyle(_:).md)
- [bold()](swiftui/text/bold().md)
- [bold(_:)](swiftui/text/bold(_:).md)
- [italic()](swiftui/text/italic().md)
- [italic(_:)](swiftui/text/italic(_:).md)
- [strikethrough(_:color:)](swiftui/text/strikethrough(_:color:).md)
- [strikethrough(_:pattern:color:)](swiftui/text/strikethrough(_:pattern:color:).md)
- [underline(_:color:)](swiftui/text/underline(_:color:).md)
- [underline(_:pattern:color:)](swiftui/text/underline(_:pattern:color:).md)
- [monospaced(_:)](swiftui/text/monospaced(_:).md)
- [kerning(_:)](swiftui/text/kerning(_:).md)
- [tracking(_:)](swiftui/text/tracking(_:).md)
- [baselineOffset(_:)](swiftui/text/baselineoffset(_:).md)
- [Text.Case](swiftui/text/case.md)
- [Text.DateStyle](swiftui/text/datestyle.md)
