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

# monospacedDigit()

Returns a modified font that uses fixed-width digits, while leaving other characters proportionally spaced.

## Declaration

```swift
func monospacedDigit() -> Font
```

## Return Value

Return Value A font that uses fixed-width numeric characters.

## Discussion

Discussion This modifier only affects numeric characters, and leaves all other characters unchanged. If the base font doesn’t support fixed-width, or monospace digits, the font remains unchanged. The following example shows two text fields arranged in a VStack. Both text fields specify the 12-point system font, with the second adding the monospacedDigit() modifier to the font. Because the text includes the digit 1, normally a narrow character in proportional fonts, the second text field becomes wider than the first. @State private var userText = "Effect of monospacing digits: 111,111."

var body: some View {     VStack {         TextField("Proportional", text: $userText)             .font(.system(size: 12))         TextField("Monospaced", text: $userText)             .font(.system(size: 12).monospacedDigit())     }     .padding()     .navigationTitle(Text("Font + monospacedDigit()")) }

## See Also

### Styling a font

- [bold()](swiftui/font/bold().md)
- [italic()](swiftui/font/italic().md)
- [monospaced()](swiftui/font/monospaced().md)
- [smallCaps()](swiftui/font/smallcaps().md)
- [lowercaseSmallCaps()](swiftui/font/lowercasesmallcaps().md)
- [uppercaseSmallCaps()](swiftui/font/uppercasesmallcaps().md)
- [weight(_:)](swiftui/font/weight(_:).md)
- [width(_:)](swiftui/font/width(_:).md)
- [Font.Width](swiftui/font/width.md)
- [leading(_:)](swiftui/font/leading(_:).md)
- [Font.Leading](swiftui/font/leading.md)
