1:
var beginPoint = CGPoint.zero
2:
override func touchesBegan(_ touches: Set< UITouch >, with event:UIEvent?){
let touch = ((touches as NSSet).anyObject() as AnyObject)
let point = touch.location(in: self.view)
self.beginPoint = point
}
3:
override func touchesMoved(_ touches: Set< UITouch >, with event:UIEvent?){
let touch = ((touches as NSSet).anyObject() as AnyObject)
let point = touch.location(in: self.view)
let lineLayer = CAShapeLayer()
lineLayer.lineWidth = 2
lineLayer.fillColor = UIColor.green.cgColor
lineLayer.strokeColor = UIColor.green.cgColor
let biz = UIBezierPath()
biz.move(to: self.beginPoint)
biz.addLine(to: point)
self.view.layer.addSublayer(lineLayer)
self.beginPoint = point
}