BolusProgressViewStyle.swift 845 B

123456789101112131415161718192021222324
  1. import SwiftUI
  2. public struct BolusProgressViewStyle: ProgressViewStyle {
  3. public func makeBody(configuration: LinearProgressViewStyle.Configuration) -> some View {
  4. ZStack {
  5. Circle()
  6. .stroke(lineWidth: 4.0)
  7. .opacity(0.3)
  8. .foregroundColor(.secondary)
  9. .frame(width: 22, height: 22)
  10. Rectangle().fill(Color.insulin)
  11. .frame(width: 8, height: 8)
  12. Circle()
  13. .trim(from: 0.0, to: CGFloat(configuration.fractionCompleted ?? 0))
  14. .stroke(style: StrokeStyle(lineWidth: 4.0, lineCap: .butt, lineJoin: .round))
  15. .foregroundColor(.insulin)
  16. .rotationEffect(Angle(degrees: -90))
  17. .frame(width: 22, height: 22)
  18. }.frame(width: 30, height: 30)
  19. }
  20. }