Created
January 16, 2019 04:52
-
-
Save almaleh/3a680c9b9e1b25cb5a849d03096ea06a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 draw(_ rect: CGRect) { | |
super.draw(rect) | |
guard let context = UIGraphicsGetCurrentContext() else { return } | |
// draw the flattened image if it exists | |
if let image = flattenedImage { | |
image.draw(in: self.bounds) | |
} | |
context.setStrokeColor(lineColor.cgColor) | |
context.setLineWidth(lineWidth) | |
context.setLineCap(.round) | |
for (index, point) in line.enumerated() { | |
if index == 0 { | |
context.move(to: point) | |
} else { | |
context.addLine(to: point) | |
} | |
} | |
context.strokePath() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment