您需要从一个视图到另一个视图绘制贝塞尔路径。
let border = CAShapeLayer()
border.strokeColor = UIColor.black.cgColor
border.lineDashPattern = [6, 4]
border.lineJoin = kCALineJoinRound
border.lineCap = kCALineCapSquare
border.frame = CGRect(x: 0, y: 0, width: 5, height: 10)
border.strokeColor = Color.blue.cgColor
border.fillColor = nil
border.path = UIBezierPath(rect: CGRect(x: 0, y: 0, width: 5, height: 10).cgPath
self.view.layer.addSublayer(border)