Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
/// Gráfico circular
internal struct CircleBar: View
/// Valor numérico
@Binding var counter: String
/// Valor porcentual
@Binding var percentage: CGFloat
/// Color que muestra el gráfico
@Binding var color: Color
/// Vista
internal var body: some View
GeometryReader() { reader in
ZStack(alignment: .center)
// El círculo de fondo
.stroke(Color(UIColor.quaternarySystemFill), lineWidth: 4)
.frame(width: (reader.size.width - 16), height: (reader.size.width - 16))
// Este es el que indica el *progreso*
.trim(from: 0.0, to: self.percentage)
.stroke(self.color, lineWidth: 4)
.frame(width: (reader.size.width - 16), height: (reader.size.width - 16))
.rotationEffect(Angle(degrees: -90.0))
.font(.system(size: 12, weight: .medium, design: .rounded))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.