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 {