I am using UIBezierPath
and CAShapeLayer
to draw a line and adding it inside a view as a sublayer. Everything works fine, Now I have to resize 'Line' with its parent view with strictly keeping the proportion same of line with the view.
Here is the code of creating a line:
let line = UIBezierPath.arrow(from: startPoint, to: endPoint, tailWidth: 5, headWidth: 20, headLength: CGFloat(inputLength * 0.1))
let shapeLayer = CAShapeLayer()
shapeLayer.path = line .cgPath
self.view.layer.addSublayer(shapeLayer)