Fix deprecation notice in ProgressView
This commit is contained in:
parent
896507d669
commit
9189033edd
1 changed files with 6 additions and 1 deletions
|
@ -14,6 +14,8 @@ struct ProgressView: View {
|
||||||
var progressTintColor: Color = .blue
|
var progressTintColor: Color = .blue
|
||||||
var progressBarHeight: Float = 20
|
var progressBarHeight: Float = 20
|
||||||
var progressBarCornerRadius: Float = 4.0
|
var progressBarCornerRadius: Float = 4.0
|
||||||
|
@State
|
||||||
|
var progressBarWidth: CGFloat = 0.0
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
|
@ -24,7 +26,10 @@ struct ProgressView: View {
|
||||||
.frame(width: getProgressBarWidth(geometry: geometry))
|
.frame(width: getProgressBarWidth(geometry: geometry))
|
||||||
.opacity(0.5)
|
.opacity(0.5)
|
||||||
.background(self.progressTintColor)
|
.background(self.progressTintColor)
|
||||||
.animation(.default)
|
.animation(.default, value: progressBarWidth)
|
||||||
|
.onAppear {
|
||||||
|
self.progressBarWidth = getProgressBarWidth(geometry: geometry)
|
||||||
|
}
|
||||||
}.frame(height: CGFloat(self.progressBarHeight))
|
}.frame(height: CGFloat(self.progressBarHeight))
|
||||||
.cornerRadius(CGFloat(self.progressBarCornerRadius))
|
.cornerRadius(CGFloat(self.progressBarCornerRadius))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue