Last active
June 14, 2020 05:16
-
-
Save anupamchugh/5af6b07f5efc1549df770c033297e7e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ProgressBar: View { | |
@Binding var progress: Double | |
var body: some View { | |
GeometryReader { geometry in | |
ZStack(alignment: .leading) { | |
Rectangle() | |
.foregroundColor(Color.gray) | |
.opacity(0.3) | |
.frame(width: geometry.size.width, height: geometry.size.height) | |
Rectangle() | |
.foregroundColor(Color.blue) | |
.frame(width: geometry.size.width * CGFloat((self.progress)), | |
height: geometry.size.height) | |
.animation(.linear(duration: 0.5)) | |
} | |
.cornerRadius(geometry.size.height / 2.0) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment