Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save prafullakumar/c2dc694fbd5b92765c4e67991b0b5613 to your computer and use it in GitHub Desktop.
Save prafullakumar/c2dc694fbd5b92765c4e67991b0b5613 to your computer and use it in GitHub Desktop.
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