From 757e8dba359288d1f8e59711268273aee35ea97c Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Thu, 10 Sep 2020 19:05:13 -0700 Subject: [PATCH] UI refinements --- Extensions/View+Extensions.swift | 9 +++++++++ Views/AddIdentityView.swift | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Extensions/View+Extensions.swift b/Extensions/View+Extensions.swift index 2fe3524..ff813f8 100644 --- a/Extensions/View+Extensions.swift +++ b/Extensions/View+Extensions.swift @@ -10,4 +10,13 @@ extension View { Alert(title: Text($0.error.localizedDescription)) } } + + @ViewBuilder + func animation(_ animation: Animation?, if condition: Bool) -> some View { + if condition { + self.animation(animation) + } else { + self + } + } } diff --git a/Views/AddIdentityView.swift b/Views/AddIdentityView.swift index 9b85274..b861a77 100644 --- a/Views/AddIdentityView.swift +++ b/Views/AddIdentityView.swift @@ -49,7 +49,7 @@ struct AddIdentityView: View { .frame(maxWidth: .infinity, alignment: .center) } } - .animation(.default) + .animation(.default, if: !viewModel.loading) .alertItem($viewModel.alertItem) .onReceive(viewModel.addedIdentityID) { id in withAnimation {