I've written this function to attempt to scale UIBezierPaths that I have as they are being drawn...
func fit(into:CGRect) -> Self {
let bounds = self.cgPath.boundingBox
let sw = into.size.width/bounds.width
let sh = into.size.height/bounds.height
let factor = min (5, min(sw, max(sh, 0.0)))
return scale(x: factor, y: factor, into: into)
}
It works ok. The problem however exists. There are dashes inbetween points sometimes. If I'm not making sense please tell me and I'll try to rephrase my question.