Hi guys,
I am wondering why do we need to currentLines.removeAll()
here?
From what i understand, every time touchesEnded, we remove the current lines, so basically currentLines
will become empty dictionary.
Thanks.
func doubleTap(_ gestureRecognizer: UIGestureRecognizer) {
print("Recognized double tap")
selectedLineIndex = nil
currentLines.removeAll()
finishedLine.removeAll()
setNeedsDisplay()
}
func longPress(_ gestureRecognizer: UIGestureRecognizer) {
print("Long press is recognized")
if gestureRecognizer.state == .began {
let point = gestureRecognizer.location(in: self)
selectedLineIndex = indexOfLine(at: point)
if selectedLineIndex != nil {
currentLines.removeAll()
}
} else if gestureRecognizer.state == .ended {
selectedLineIndex = nil
}
setNeedsDisplay()
}