Created
October 6, 2020 04:33
-
-
Save prafullakumar/c2dc694fbd5b92765c4e67991b0b5613 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public struct CirclerPercentageProgressViewStyle : ProgressViewStyle { | |
| public func makeBody(configuration: LinearProgressViewStyle.Configuration) -> some View { | |
| VStack(spacing: 10) { | |
| configuration.label | |
| .foregroundColor(Color.secondary) | |
| ZStack { | |
| Circle() | |
| .stroke(lineWidth: 15.0) | |
| .opacity(0.3) | |
| .foregroundColor(Color.accentColor.opacity(0.5)) | |
| Circle() | |
| .trim(from: 0.0, to: CGFloat(configuration.fractionCompleted ?? 0)) | |
| .stroke(style: StrokeStyle(lineWidth: 15.0, lineCap: .round, lineJoin: .round)) | |
| .foregroundColor(Color.accentColor) | |
| Text("\(Int((configuration.fractionCompleted ?? 0) * 100))%") | |
| .font(.headline) | |
| .foregroundColor(Color.secondary) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment