27 lines
761 B
Swift
27 lines
761 B
Swift
|
|
import SwiftUI
|
||
|
|
|
||
|
|
struct ProgressRing: View {
|
||
|
|
let progress: Double
|
||
|
|
var lineWidth: CGFloat = 14
|
||
|
|
var size: CGFloat = 200
|
||
|
|
var color: Color = AppTheme.blue
|
||
|
|
var backgroundColor: Color = Color(hex: "#E5E7EB")
|
||
|
|
|
||
|
|
var body: some View {
|
||
|
|
ZStack {
|
||
|
|
Circle()
|
||
|
|
.stroke(backgroundColor, lineWidth: lineWidth)
|
||
|
|
|
||
|
|
Circle()
|
||
|
|
.trim(from: 0, to: CGFloat(min(progress, 1.0)))
|
||
|
|
.stroke(
|
||
|
|
color,
|
||
|
|
style: StrokeStyle(lineWidth: lineWidth, lineCap: .round)
|
||
|
|
)
|
||
|
|
.rotationEffect(.degrees(-90))
|
||
|
|
.animation(.easeInOut(duration: 0.4), value: progress)
|
||
|
|
}
|
||
|
|
.frame(width: size, height: size)
|
||
|
|
}
|
||
|
|
}
|