drewblaisdell
drewblaisdell

Reputation: 610

CGPathAddArc path not appearing in SpriteKit with Swift

Using Xcode 6 beta 6, I am able to draw a straight path, but whenever I use CGPathAddArc or CGPathAddArcToPoint, the path does not appear.

Following the answer from this this question, the following should draw a half circle.

var line = SKShapeNode()
line.zPosition = 3
line.position = CGPointMake(100, 100)
var path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, 0, 0)
CGPathAddArc(path, nil, 0, 15, 15, CGFloat(M_PI_2), CGFloat(-M_PI_2), true);
line.path = path
line.strokeColor = SKColor.redColor()
self.addChild(line)

Unfortunately, nothing appears. If I change CGPathAddArc to CGPathAddLineToPoint a path is successfully drawn on the screen. Is the code above incorrect?

Upvotes: 4

Views: 2309

Answers (1)

Alexey Pichukov
Alexey Pichukov

Reputation: 3405

I have the same problem and it looks like a bug. This problem appeared after upgrading to Xcode 6 beta 6. The same code correctly drew a circle in Xcode 6 beta 1.

Upvotes: 5

Related Questions