taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 3a8281d21ab537309bacc0b44266c647fec8e3a0
parent 4e340f58b33d0c65d705998e5d8e8851422f3c00
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 26 Oct 2023 13:13:23 +0200

Currency Symbol

Diffstat:
MTalerWallet1/Helper/CurrencySpecification.swift | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 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)