From 94698cb988e75121cfb1082180c3094f7f5a1efb Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 10 Nov 2024 15:49:44 -0600 Subject: [PATCH] onboarding buttons only have one clear button --- .../View/OnboardingView.swift | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/BDKSwiftExampleWallet/View/OnboardingView.swift b/BDKSwiftExampleWallet/View/OnboardingView.swift index 2e6adae..08dd1a8 100644 --- a/BDKSwiftExampleWallet/View/OnboardingView.swift +++ b/BDKSwiftExampleWallet/View/OnboardingView.swift @@ -29,41 +29,39 @@ struct OnboardingView: View { Spacer() - Button { - showingScanner = true - } label: { - Image( - systemName: viewModel.words.isEmpty - ? "qrcode.viewfinder" : "clear" - ) - .contentTransition(.symbolEffect(.replace)) - } - .tint( - viewModel.words.isEmpty ? .secondary : .primary - ) - .font(.title) - .padding() + if viewModel.words.isEmpty { + Button { + showingScanner = true + } label: { + Image(systemName: "qrcode.viewfinder") + .contentTransition(.symbolEffect(.replace)) + } + .tint(.secondary) + .font(.title) + .padding() - Button { - if viewModel.words.isEmpty { + Button { if let clipboardContent = UIPasteboard.general.string { viewModel.words = clipboardContent } - } else { + } label: { + Image(systemName: "arrow.down.square") + .contentTransition(.symbolEffect(.replace)) + } + .tint(.secondary) + .font(.title) + .padding() + } else { + Button { viewModel.words = "" + } label: { + Image(systemName: "clear") + .contentTransition(.symbolEffect(.replace)) } - } label: { - Image( - systemName: viewModel.words.isEmpty - ? "arrow.down.square" : "clear" - ) - .contentTransition(.symbolEffect(.replace)) + .tint(.primary) + .font(.title) + .padding() } - .tint( - viewModel.words.isEmpty ? .secondary : .primary - ) - .font(.title) - .padding() } Spacer()