Files
Kisani/Shared/Components/ProgressRing.swift

24 lines
757 B
Swift
Raw Permalink Normal View History

import SwiftUI
struct ProgressRing: View {
let progress: Double
var lineWidth: CGFloat = 8
var size: CGFloat = 200
var color: Color = AppTheme.ink
var backgroundColor: Color = Color(hex: "#EBEBEB")
var body: some View {
ZStack {
Circle()
.stroke(backgroundColor, style: StrokeStyle(lineWidth: lineWidth, lineCap: .round))
Circle()
.trim(from: 0, to: CGFloat(min(progress, 1.0)))
.stroke(color, style: StrokeStyle(lineWidth: lineWidth, lineCap: .round))
.rotationEffect(.degrees(-90))
.animation(.spring(response: 0.5, dampingFraction: 0.8), value: progress)
}
.frame(width: size, height: size)
}
}