Last active
December 5, 2019 18:51
-
-
Save almaleh/e661fc9cffc2e18fc826adbec471902c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { | |
guard let newTouchPoint = touches.first?.location(in: self) else { return } | |
let lastTouchPoint: CGPoint = line.last ?? .zero | |
line.append(newTouchPoint) | |
let rect = calculateRectBetween(lastPoint: lastTouchPoint, newPoint: newTouchPoint) | |
layer.setNeedsDisplay(rect) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment