Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import CoreGraphics
private typealias CGPathDumpUtility = CGPath
extension CGPathDumpUtility {
func dump() {
self.apply(info: nil) { info, unsafeElement in
let element = unsafeElement.pointee
switch element.type {
case .moveToPoint:
let point = element.points[0]
print("moveto - \(point)")
case .addLineToPoint:
let point = element.points[0]
print("lineto - \(point)")
case .addQuadCurveToPoint:
let control = element.points[0]
let point = element.points[1]
print("quadCurveTo - \(point) - \(control)")
case .addCurveToPoint:
let control1 = element.points[0]
let control2 = element.points[1]
let point = element.points[2]
print("curveTo - \(point) - \(control1) - \(control2)")
case .closeSubpath:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment