Reputation: 5892
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?
Upvotes: 3
Views: 308
Reputation: 5892
It seems the most SwiftUI-y way is this:
Text(verbatim: "\(viewingYear)")
Upvotes: 0
Reputation: 257493
Use it as string literal like below
.navigationBarTitle(LocalizedStringKey(stringLiteral: "\(viewingYear)"),
displayMode: .inline)
Upvotes: 2