If I understand you correctly, you'd like to subclass SKShapeNode to make circles with less scene code, is that right? Here is an example of such a sublass:
import SpriteKit
class CircleNode: SKShapeNode {
init( radius: CGFloat, lineWidth: CGFloat, fillColor: SKColor, strokeColor: SKColor ) {
super.init()
let myPath = CGPathCreateMutable()
CGPathAddArc( myPath, nil, 0,0, 15, 0, CGFloat( M_PI * 2.0 ), true )
path = myPath
self.lineWidth = lineWidth
self.fillColor = fillColor
self.strokeColor = strokeColor
glowWidth = 0.5
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Scene code that uses the CircleNode:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch in touches {
let location = touch.locationInNode(self)
let sprite = CircleNode(radius: 50.0, lineWidth: 5.0, fillColor: SKColor.blackColor(), strokeColor: SKColor.redColor() )
sprite.position = location
self.addChild(sprite)
}
}