diff --git a/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBar.swift b/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBar.swift index 011359c8..651b7f65 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBar.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBar.swift @@ -84,7 +84,7 @@ import UIKit } // show circular progress view with animation. - showProgressWithAnimation(duration: 0.5, value: Float(graphModel?.percent ?? 0) / 100) + showProgressWithAnimation(duration: graphModel?.duration ?? 1.0, value: Float(graphModel?.percent ?? 0) / 100) // show progress percentage label. showProgressPercentage() diff --git a/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBarModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBarModel.swift index 6c58be43..252f4893 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBarModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CircularProgressBarModel.swift @@ -21,6 +21,7 @@ public class CircularProgressBarModel: MoleculeModelProtocol { } public var diameter: CGFloat = 84 public var lineWidth: CGFloat = 5 + public var duration : Double = 1.0 public var color: Color? public var trackColor: Color? public var percent: Int? @@ -35,6 +36,7 @@ public class CircularProgressBarModel: MoleculeModelProtocol { case size case diameter case lineWidth + case duration case color case trackColor case percent @@ -59,6 +61,10 @@ public class CircularProgressBarModel: MoleculeModelProtocol { self.lineWidth = lineWidth } + if let duration = try typeContainer.decodeIfPresent(Double.self, forKey: .duration) { + self.duration = duration + } + color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) trackColor = try typeContainer.decodeIfPresent(Color.self, forKey: .trackColor) percent = try typeContainer.decodeIfPresent(Int.self, forKey: .percent) @@ -73,6 +79,7 @@ public class CircularProgressBarModel: MoleculeModelProtocol { try container.encode(size, forKey: .size) try container.encode(diameter, forKey: .diameter) try container.encode(lineWidth, forKey: .lineWidth) + try container.encode(duration, forKey: .duration) try container.encodeIfPresent(trackColor, forKey: .trackColor) try container.encodeIfPresent(color, forKey: .color) try container.encodeIfPresent(percent, forKey: .percent)