88public import Foundation
99
1010/// A graphics path is a mathematical description of a series of shapes or lines.
11- public struct CGPath {
11+ public final class CGPath {
1212
1313 public typealias Element = PathElement
1414
@@ -20,6 +20,14 @@ public struct CGPath {
2020 }
2121}
2222
23+ public final class CGPathRef {
24+ public var path : CGPath
25+
26+ public init ( path: CGPath ) {
27+ self . path = path
28+ }
29+ }
30+
2331// MARK: - Supporting Types
2432
2533/// A path element.
@@ -48,7 +56,7 @@ public enum PathElement {
4856
4957public extension CGPath {
5058
51- mutating func addRect( _ rect: CGRect ) {
59+ func addRect( _ rect: CGRect ) {
5260
5361 let newElements : [ Element ] = [ . moveToPoint( CGPoint ( x: rect. minX, y: rect. minY) ) ,
5462 . addLineToPoint( CGPoint ( x: rect. maxX, y: rect. minY) ) ,
@@ -59,7 +67,7 @@ public extension CGPath {
5967 elements. append ( contentsOf: newElements)
6068 }
6169
62- mutating func addEllipse( in rect: CGRect ) {
70+ func addEllipse( in rect: CGRect ) {
6371
6472 var p = CGPoint ( )
6573 var p1 = CGPoint ( )
@@ -92,27 +100,27 @@ public extension CGPath {
92100 elements. append ( . addCurveToPoint( p1, p2, p) )
93101 }
94102
95- mutating func move( to point: CGPoint ) {
103+ func move( to point: CGPoint ) {
96104
97105 elements. append ( . moveToPoint( point) )
98106 }
99107
100- mutating func addLine( to point: CGPoint ) {
108+ func addLine( to point: CGPoint ) {
101109
102110 elements. append ( . addLineToPoint( point) )
103111 }
104112
105- mutating func addCurve( to endPoint: CGPoint , control1: CGPoint , control2: CGPoint ) {
113+ func addCurve( to endPoint: CGPoint , control1: CGPoint , control2: CGPoint ) {
106114
107115 elements. append ( . addCurveToPoint( control1, control2, endPoint) )
108116 }
109117
110- mutating func addQuadCurve( to endPoint: CGPoint , control: CGPoint ) {
118+ func addQuadCurve( to endPoint: CGPoint , control: CGPoint ) {
111119
112120 elements. append ( . addQuadCurveToPoint( control, endPoint) )
113121 }
114122
115- mutating func closeSubpath( ) {
123+ func closeSubpath( ) {
116124
117125 elements. append ( . closeSubpath)
118126 }
0 commit comments