I was surprised to find that some kind of default number formatter is applied to SwiftUI Text? For example, with this code:
.navigationBarTitle("\(viewingYear)", displayMode: .inline)
Where viewingYear is the integer 1491, it is shown like this:

How do I disable this behavior so it's shown as 1491 and not 1,491?
Use it as string literal like below
.navigationBarTitle(LocalizedStringKey(stringLiteral: "\(viewingYear)"),
displayMode: .inline)
It seems the most SwiftUI-y way is this:
Text(verbatim: "\(viewingYear)")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With