Is there a way to set the NSLocale
for a NSNumberFormatter
via the currency code instead of the locale identifier in iOS?
Like, for instance, to use "USD" instead of "en_US" in any point of the locale setting?
I see there's a NSLocaleCurrencyCode object, but I'm not sure what method I can use from it to set the NSNumberFormatter's
locale
.
I'm currently using Swift, if that makes the process any easier.
EDIT: For further explanation of what I'm doing, I have a list of every single country's currency code (USD, GBP, JPY, CNY, etc...). The user picks whichever currency he's using via these codes, and then I want the NSNumberFormatter to automatically set its locale to the locale of that currency to automatically format it.