From 4f0a4db77f1a69b72762ae2bd3ee35198e4442a2 Mon Sep 17 00:00:00 2001 From: Matthew Ramsden <6657488+reez@users.noreply.github.com> Date: Sun, 29 Sep 2024 13:33:21 -0500 Subject: [PATCH] ui: price animation --- .../Resources/Localizable.xcstrings | 3 +++ BDKSwiftExampleWallet/View/WalletView.swift | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/BDKSwiftExampleWallet/Resources/Localizable.xcstrings b/BDKSwiftExampleWallet/Resources/Localizable.xcstrings index 49d152b..7870ba9 100644 --- a/BDKSwiftExampleWallet/Resources/Localizable.xcstrings +++ b/BDKSwiftExampleWallet/Resources/Localizable.xcstrings @@ -181,6 +181,9 @@ } } } + }, + "$" : { + }, "12 Word Seed Phrase (Optional)" : { "extractionState" : "stale", diff --git a/BDKSwiftExampleWallet/View/WalletView.swift b/BDKSwiftExampleWallet/View/WalletView.swift index d735168..1076328 100644 --- a/BDKSwiftExampleWallet/View/WalletView.swift +++ b/BDKSwiftExampleWallet/View/WalletView.swift @@ -66,9 +66,17 @@ struct WalletView: View { .variableColor.cumulative ) } - Text(viewModel.satsPrice, format: .currency(code: "USD")) - .contentTransition(.numericText()) - .fontDesign(.rounded) + if viewModel.walletSyncState == .synced { + Text(viewModel.satsPrice, format: .currency(code: "USD")) + .fontDesign(.rounded) + .contentTransition(.numericText()) + .animation(.spring(response: 0.5, dampingFraction: 0.6, blendDuration: 0.5), value: viewModel.satsPrice) + } else { + Text("$") + .foregroundStyle(.secondary) + .fontDesign(.rounded) + .transition(.opacity) + } } .foregroundStyle(.secondary) .font(.subheadline)