https://www.raywenderlich.com/8003281-core-graphics-tutorial-getting-started
The code is not exactly correct. If I follow code literally it doesn’t compile. For example:
import UIKit
@IBDesignable class CounterView: UIView {
private struct Constants {
static let numberOfGlasses = 8
static let lineWidth: CGFloat = 5.0
static let arcWidth: CGFloat = 76
static var halfOfLineWidth: CGFloat {
return lineWidth / 2
}
}
@IBInspectable var counter: Int = 5
@IBInspectable var outlineColor: UIColor = UIColor.blue
@IBInspectable var counterColor: UIColor = UIColor.orange
>
> override func draw(_ rect: CGRect) {
> }
> }
lineWidth is in Constants struct. So halfOfLineWidth parameter will show error.