diff options
-rw-r--r-- | TalerWallet1/Helper/CurrencySpecification.swift | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/TalerWallet1/Helper/CurrencySpecification.swift b/TalerWallet1/Helper/CurrencySpecification.swift index cbbefc1..9adff4b 100644 --- a/TalerWallet1/Helper/CurrencySpecification.swift +++ b/TalerWallet1/Helper/CurrencySpecification.swift @@ -27,6 +27,15 @@ public struct CurrencyInfo { } } + func symbol() -> String? { + if formatter.hasAltUnitName0 { + if let symbol = specs.altUnitNames?[0] { + return symbol + } + } + return nil + } + func string(for valueTuple: (Double, Double), useSymbol: Bool = true) -> String { formatter.setUseSymbol(useSymbol) let (integer, fraction) = valueTuple @@ -70,10 +79,8 @@ public struct CurrencyInfo { // we need to format ourselves var currencyName = scope.currency if useSymbol { - if formatter.hasAltUnitName0 { - if let symbol = specs.altUnitNames?[0] { - currencyName = symbol - } + if let symbol = symbol() { + currencyName = symbol } } var madeUpStr = currencyName + " " + String(integer) |