Trying to make a computed property that show all possible currencies to be shown on a UIPickerView. Currently, the symbols I get in my array always is ¤ any tips to make it work?
import UIKit
struct MyCurrency: Codable {
let code: String
let name: String
let symbol: String
}
var currencies: [MyCurrency] {
return Locale.Currency.isoCurrencies.compactMap {
guard let name = Locale.current.localizedString(forCurrencyCode: $0.identifier),
let symbol = Locale(identifier: $0.identifier).currencySymbol else { return nil }
return MyCurrency(code: $0.identifier, name: name, symbol: symbol)
}
}
print(currencies)
