I am building an app using circles. I'm fairly new to iOS programming, and I'm digging into SpriteKit. I found a code sample here:
func circlePhysicsDefault() {
var Circle = SKShapeNode(circleOfRadius: 40)
Circle.position = CGPointMake(500, 500)
Circle.name = "defaultCircle"
Circle.strokeColor = SKColor.blackColor()
Circle.glowWidth = 10.0
Circle.fillColor = SKColor.yellowColor()
Circle.physicsBody = SKPhysicsBody(circleOfRadius: 40)
Circle.physicsBody!.dynamic = true
self.addChild(Circle)
}
However, the final line:
self.addChild(Circle)
results in an error saying the viewController does not have a member named 'addChild'. I'm stumped as to what's going on here after digging through the documentation for SKShapeNode and other SO questions.
Some people think it's an error related to optionals. If so, I'm unclear what to change to fix it. Any ideas?
Thank you so much for your help in advance.