Search code examples
objective-cswiftsprite-kitstrokeskshapenode

SKShapeNode stroke not drawing in Swift


I have this code:

    self.shapeNode = SKShapeNode(rect: CGRect(origin: CGPointMake(-0.5*size.width, -0.5*size.height), size: size))
    self.shapeNode.fillColor = UIColor.lightBlueColor()
    self.shapeNode.strokeColor = UIColor.brownColor()

The shapeNode appears and its fill color is drawn, though its stroke isn't. Back in iOS 7 in Obj-C, the same code works to draw the stroke.


Solution

  • Indeed, this turned out to be just a bug in the simulator. Yesterday, I installed the public version of iOS 8 on an iPad, ran my game on it and the strokes appeared. Apple should provide a fix for this soon, though.