Convert SVG path data to a Swift 3 UIBezierPath

As an iOS developer, you have to support at least three different pixel densities. Why waste your time managing a million image assets for different resolutions and states?

swiftvg is a little tool written in javascript to help you convert your vector SVG images into UIBezierPath shapes. Paste the string from the d attribute and vóila, your UIBezierPath code is generated for you.

The code is open source (MIT) on Github. Check it out, maybe.

let shape = UIBezierPath()
shape.move(to: CGPoint(x: 10, y: 6))
shape.addLine(to: CGPoint(x: 10, y: 0))
shape.addLine(to: CGPoint(x: 6, y: 0))
shape.addLine(to: CGPoint(x: 6, y: 6))
shape.addLine(to: CGPoint(x: 0, y: 6))
shape.addLine(to: CGPoint(x: 0, y: 10))
shape.addLine(to: CGPoint(x: 6, y: 10))
shape.addLine(to: CGPoint(x: 6, y: 16))
shape.addLine(to: CGPoint(x: 10, y: 16))
shape.addLine(to: CGPoint(x: 10, y: 10))
shape.addLine(to: CGPoint(x: 16, y: 10))
shape.addLine(to: CGPoint(x: 16, y: 6))
shape.addLine(to: CGPoint(x: 10, y: 6))
shape.close()