From 9189033eddc3b883f2236de3d1522cefdc5e3659 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Wed, 18 May 2022 20:05:03 -0600 Subject: [PATCH] Fix deprecation notice in ProgressView --- Twigs/Views/ProgressView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Twigs/Views/ProgressView.swift b/Twigs/Views/ProgressView.swift index 292a08c..b1a7c20 100644 --- a/Twigs/Views/ProgressView.swift +++ b/Twigs/Views/ProgressView.swift @@ -14,6 +14,8 @@ struct ProgressView: View { var progressTintColor: Color = .blue var progressBarHeight: Float = 20 var progressBarCornerRadius: Float = 4.0 + @State + var progressBarWidth: CGFloat = 0.0 var body: some View { GeometryReader { geometry in @@ -24,7 +26,10 @@ struct ProgressView: View { .frame(width: getProgressBarWidth(geometry: geometry)) .opacity(0.5) .background(self.progressTintColor) - .animation(.default) + .animation(.default, value: progressBarWidth) + .onAppear { + self.progressBarWidth = getProgressBarWidth(geometry: geometry) + } }.frame(height: CGFloat(self.progressBarHeight)) .cornerRadius(CGFloat(self.progressBarCornerRadius)) }