Learn Courses My Dashboard

Strange Symbol appearing in Numberformatter = .currency

I created a NumberFormatter to pass a Double to string in as a currency style. but i get this symbol instead of the dollar symbol $

Anyone know how to fix it?

let formatter = NumberFormatter()
formatter.numberStyle = .currency
if let price = formatter.string(from: product.price as NSNumber) {
productPrice.text = price
}

Captura de Pantalla 2021-03-23 a la(s) 21.07.55

That’s the Unicode unspecified currency symbol (U+00A4). I’m not sure under what conditions that symbol will show instead of a specific currency symbol, but check your Locale with print(NSLocale.current) and see if it’s set to something weird.

1 Like