So I'm using a TextField with a formatter, the issue is unless the user hits return that value is not captured which is causing some distress for users, even though I have added a label stating they should hit return, but in fairness it doesn't seem professional. How can I combat this issue? Is there a way in which I can capture the input as the user inputs data into the textfield, as well as formatting the input simultaneously?
This is my code:
var currencyFormatter: NumberFormatter = {
let val = NumberFormatter()
val.numberStyle = .currency
val.currencyCode = "GBP"
return val
}()
TextField("0", value: $viewModel.price, formatter: currencyFormatter)
.foregroundColor(Color(SYSTEM_FONT_COLOUR))
Thank you.