Skip to content

Instantly share code, notes, and snippets.

@justinlevi
Created June 26, 2015 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinlevi/89da0206bbf461aad745 to your computer and use it in GitHub Desktop.
Save justinlevi/89da0206bbf461aad745 to your computer and use it in GitHub Desktop.
Swift 2 Xcode Beta 2 - Ole Begemann Post Sytax Update
public enum PathElement {
case MoveToPoint(CGPoint)
case AddLineToPoint(CGPoint)
case AddQuadCurveToPoint(CGPoint, CGPoint)
case AddCurveToPoint(CGPoint, CGPoint, CGPoint)
case CloseSubpath
init(element: CGPathElement) {
switch element.type {
case .MoveToPoint:
self = .MoveToPoint(element.points[0])
case .AddLineToPoint:
self = .AddLineToPoint(element.points[0])
case .AddQuadCurveToPoint:
self = .AddQuadCurveToPoint(element.points[0], element.points[1])
case .AddCurveToPoint:
self = .AddCurveToPoint(element.points[0], element.points[1], element.points[2])
case .CloseSubpath:
self = .CloseSubpath
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment