commit 146b3c2ea63c79a1b99a4dfc01d7557e64e136e3
parent d08570f07472d4426a5642ad00ed5860eb24e995
Author: Marc Stibane <marc@taler.net>
Date: Sat, 12 Apr 2025 18:17:49 +0200
init from Amount
Diffstat:
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/AmountV.swift b/TalerWallet1/Views/HelperViews/AmountV.swift
@@ -107,6 +107,16 @@ extension AmountV {
self.large = true
self.a11yDecSep = nil
}
+ init(_ currency: String, amount: Amount, isNegative: Bool?) {
+ self.stack = nil
+ self.scope = nil
+ self.amount = Amount(currency: currency , integer: amount.integer, fraction: amount.fraction)
+ self.isNegative = isNegative
+ self.useISO = false
+ self.strikethrough = false
+ self.large = true
+ self.a11yDecSep = nil
+ }
init(_ scope: ScopeInfo?, _ amount: Amount, isNegative: Bool?, strikethrough: Bool) {
self.stack = nil
self.scope = scope
diff --git a/taler-swift/Sources/taler-swift/Amount.swift b/taler-swift/Sources/taler-swift/Amount.swift
@@ -94,10 +94,10 @@ public final class Amount: Codable, Hashable, @unchecked Sendable, CustomStringC
}
/// The integer value of the amount (number to the left of the decimal point).
- var integer: UInt64
-
+ public var integer: UInt64
+
/// The fractional value of the amount (number to the right of the decimal point).
- var fraction: UInt32
+ public var fraction: UInt32
public func hash(into hasher: inout Hasher) {
hasher.combine(currency)