Update WidgetDataStore.swift

This commit is contained in:
marcosrdz 2020-11-20 23:11:51 -05:00
parent a476e38c4b
commit 22dd7b0a46

View File

@ -15,12 +15,11 @@ struct WidgetDataStore {
var formattedRate: String? {
let numberFormatter = NumberFormatter()
numberFormatter.locale = Locale(identifier: WidgetAPI.getUserPreferredCurrencyLocale())
numberFormatter.numberStyle = .decimal
numberFormatter.numberStyle = .currency
numberFormatter.maximumFractionDigits = 0
numberFormatter.minimumFractionDigits = 0
if let rateNumber = numberFormatter.number(from: rate) {
numberFormatter.numberStyle = .currency
return numberFormatter.string(from: rateNumber);
if let rateString = numberFormatter.string(from: NSNumber(value: rateDouble)) {
return rateString
}
return rate
}