summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2023-10-26 13:13:23 +0200
committerMarc Stibane <marc@taler.net>2023-10-26 13:13:23 +0200
commit3a8281d21ab537309bacc0b44266c647fec8e3a0 (patch)
tree9b46305d230db805e4360a174e8c1c637382e7f9
parent4e340f58b33d0c65d705998e5d8e8851422f3c00 (diff)
downloadtaler-ios-3a8281d21ab537309bacc0b44266c647fec8e3a0.tar.gz
taler-ios-3a8281d21ab537309bacc0b44266c647fec8e3a0.tar.bz2
taler-ios-3a8281d21ab537309bacc0b44266c647fec8e3a0.zip
Currency Symbol
-rw-r--r--TalerWallet1/Helper/CurrencySpecification.swift15
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)