Swift 3 (SpriteKit): Change the properties of each line in CGPath

122 views Asked by At

I was wondering if for each line that is added to a CGPath, you can change the properties of it like the lineWidth and strokeColor. Currently I create the CGPath like this:

let path = CGMutablePath()

points = [CGPoint(x: -372, y: -250), CGPoint(x: 372, y: -250)]
path.move(to: CGPoint(x: points[0].x, y: points[0].y))
//Somewhere here change the properties of the line before adding it
path.addLine(to: CGPoint(x: points[1].x, y: points[1].y))
//Or after here

Line.path = path

Is this possible to individually change the properties of each line added to a CGPath, or does the whole CGPath have only one set color and lineWidth?

1

There are 1 answers

0
Confused On

It's far worse than you think. The mutable part of CGPath is a lie.