I've got a bezier with a stroke which is contained within a frame. My bezier resizes dynamically along with the frame very nicely, but the stroke width is static which makes it look bad at small sizes. (Notice how the stroke isn't proportional on the small star below.)
My first thought was to make the stroke width (normally 5) an expression that was based something like 5.0*(frame.width/standardwidth)
but I'm not allowed to reference the frame variable.
How can I make an expression to calculate a stroke width based on the frame width? Or somehow make the stroke width dynamically sized like the rest of the elements within the frame?
For me this works out of the box. That is:
"...somehow make the stroke width dynamically sized like the rest of the elements within the frame"
Versions:
PaintCode Setup
Custom View
import Foundation
import UIKit
@IBDesignable class StarView: UIView {
override func draw(_ rect: CGRect) {
StyleKit.drawStarIcon(frame: rect)
}
}
Final Result
GitHub