Trying to save Locales into CoreData and just wasn't sure what format I should save the data.
let locale = Locale.current
let currencyCodesArray = Locale.commonISOCurrencyCodes
for currencyCode in currencyCodesArray {
// let currencyName = locale.displayName(forKey:NSLocale.Key.currencyCode, value : currencyCode)
let currencyName = locale.localizedString(forCurrencyCode: currencyCode)
//let currencySymbol = locale.displayName(forKey:NSLocale.Key.currencySymbol, value : currencyCode)
let currencySymbol = locale.currencySymbol
let identifier = locale.localizedString(forIdentifier: currencyCode)
print(identifier);
if let _ = currencySymbol, let currencyName = currencyName{
let currencyModel = CurrencyModel()
currencyModel.currencyName = currencyName
currencyModel.currencyCode = currencyCode
currencyModel.currencySymbol = currencySymbol!
//currencyModel.identifier = identifier
currencies.append(currencyModel)
//print(identifier);
}
}
From each locale I'm trying to save: currency code - string Identifier - String currency name - String currency symbol - String
Should I be saving each of these properties on their own, or is it possible to save the entire Locale?