I am setting up an little in app purchase store for muliple countries. How can I figure out that I have to show up the price in Dollar, Euro etc...
I think it have to do with the localeIdentifier but I am not sure how to handle this
You can get the currency symbol and code from
Swift 1 and 2
let locale = NSLocale.currentLocale() let currencySymbol = locale.objectForKey(NSLocaleCurrencySymbol)! let currencyCode = locale.objectForKey(NSLocaleCurrencyCode)!
let locale = Locale.current() let currencySymbol = locale.object(forKey: .currencySymbol)! let currencyCode = locale.object(forKey: .currencyCode)!
In later Swift 3 beta versions both values for keys
currencyCode are turned directly into properties.
let locale = Locale.current() let currencySymbol = locale.currencySymbol let currencyCode = locale.currencyCode
This correlates with the user region format settings and works in both