@@ -26,11 +26,17 @@ import UIKit
26
26
open class ALProgressRing : UIView {
27
27
28
28
// MARK: Properties
29
- /// The line width of the ring.
30
- public var lineWidth : CGFloat = 10 {
29
+ /// The line width of the progress ring.
30
+ public var ringWidth : CGFloat = 10 {
31
31
didSet {
32
- ringLayer. lineWidth = lineWidth
33
- grooveLayer. lineWidth = lineWidth
32
+ ringLayer. lineWidth = ringWidth
33
+ }
34
+ }
35
+
36
+ /// The line width of the groove ring.
37
+ public var grooveWidth : CGFloat = 10 {
38
+ didSet {
39
+ grooveLayer. lineWidth = grooveWidth
34
40
}
35
41
}
36
42
@@ -77,7 +83,7 @@ open class ALProgressRing: UIView {
77
83
78
84
/// The radius of the ring.
79
85
public var radius : CGFloat {
80
- return min ( bounds. height, bounds. width) / 2 - lineWidth / 2
86
+ return min ( bounds. height, bounds. width) / 2 - ringWidth / 2
81
87
}
82
88
83
89
/// The progress of the ring between 0 and 1. The ring will fill based on the value.
@@ -172,12 +178,11 @@ open class ALProgressRing: UIView {
172
178
173
179
private func styleRingLayer( ) {
174
180
grooveLayer. strokeColor = grooveColor. cgColor
175
- grooveLayer. lineWidth = lineWidth
181
+ grooveLayer. lineWidth = grooveWidth
176
182
177
- ringLayer. lineWidth = lineWidth
183
+ ringLayer. lineWidth = ringWidth
178
184
ringLayer. strokeColor = UIColor . black. cgColor
179
185
ringLayer. strokeEnd = min ( progress, 1.0 )
180
- ringLayer. lineWidth = lineWidth
181
186
182
187
gradientLayer. colors = [ startColor. cgColor, endColor. cgColor]
183
188
gradientLayer. startPoint = CGPoint ( x: 0.0 , y: 0 )
0 commit comments