I'd just like to know whether there's a bug in macOS or if I have to make changes in code with currency formatted TextField
s.
My problem: just a simple TextField
in SwiftUI like
TextField("amountOnDeadline",value: $startValue, formatter: Formatters.currencyFormatter)
The formatter ist pretty simple:
static let currencyFormatter: NumberFormatter = {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.maximumFractionDigits = 2
return formatter
}()
Build and run! The offered field is displayed as currency field. Great! But when I enter a number like 123, the field is reset to 0.00 € (or the value displayed on start). Only when I exactly mark the 0.00 without the currency symbol and enter a value, the new value is taken.
This is not very user friendly. Is it something I have to live with or is there a solution for this problem? e.g. a special config in NumberFormatter.