commit e55bb0473a4b88a34ec55cbd47243c7b07a92f35
parent a5a8a718405d830253d86f662c1891fc6ee80c45
Author: Marc Stibane <marc@taler.net>
Date: Mon, 13 Nov 2023 21:10:58 +0100
Previews
Diffstat:
3 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -101,6 +101,7 @@ struct BalanceRowView: View {
#if DEBUG
struct BalanceRowView_Previews: PreviewProvider {
+ @MainActor
struct StateContainer: View {
var body: some View {
let test = Amount(currency: TESTCURRENCY, cent: 123)
diff --git a/TalerWallet1/Views/Balances/PendingRowView.swift b/TalerWallet1/Views/Balances/PendingRowView.swift
@@ -121,8 +121,9 @@ func PreviewCurrencyInfo(_ currency: String, digits: Int) -> CurrencyInfo {
return CurrencyInfo(scope: scope, specs: specs, formatter: formatter)
}
-struct PendingRowView_Previews: PreviewProvider {
- static var previews: some View {
+@MainActor
+fileprivate struct Preview_Content: View {
+ var body: some View {
let test = Amount(currency: TESTCURRENCY, cent: 123)
let demo = Amount(currency: DEMOCURRENCY, cent: 123456)
List {
@@ -131,4 +132,18 @@ struct PendingRowView_Previews: PreviewProvider {
}
}
}
+fileprivate struct Previews: PreviewProvider {
+ @MainActor
+ struct StateContainer: View {
+// @StateObject private var controller = Controller.shared
+ var body: some View {
+ Text("Hello")
+// Preview_Content()
+// .environmentObject(controller)
+ }
+ }
+ static var previews: some View {
+ StateContainer()
+ }
+}
#endif
diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift b/TalerWallet1/Views/Peer2peer/SendAmount.swift
@@ -100,12 +100,12 @@ struct SendAmount: View {
}
// MARK: -
#if DEBUG
-struct SendAmount_Container : View {
- @State private var amountToTransfer = Amount(currency: DEMOCURRENCY, cent: 510)
+fileprivate struct Preview_Content: View {
+ @State private var amountToTransfer = Amount(currency: TESTCURRENCY, cent: 510)
@State private var summary: String = ""
var body: some View {
- let amount = Amount(currency: LONGCURRENCY, integer: 10, fraction: 0)
+ let amount = Amount(currency: TESTCURRENCY, integer: 10, fraction: 0)
SendAmount(stack: CallStack("Preview"),
amountAvailable: amount,
amountToTransfer: $amountToTransfer,
@@ -113,9 +113,17 @@ struct SendAmount_Container : View {
}
}
-//struct SendAmount_Previews: PreviewProvider {
-// static var previews: some View {
-// SendAmount_Container()
-// }
-//}
+fileprivate struct Previews: PreviewProvider {
+ @MainActor
+ struct StateContainer: View {
+ @StateObject private var controller = Controller.shared
+ var body: some View {
+ Preview_Content()
+ .environmentObject(controller)
+ }
+ }
+ static var previews: some View {
+ StateContainer()
+ }
+}
#endif