I'm trying to subclass SKShapeNode
with Swift. So far I've got something like this:
import UIKit
import SpriteKit
class STGridNode: SKShapeNode {
init() {
super.init()
self.name = "STGridNode"
self.fillColor = UIColor(red: 0.11, green: 0.82, blue: 0.69, alpha: 1)
}
}
In my code I want so do something along the lines of:
let s = STGridNode(rectOfSize: CGSize(width: 100, height: 100))
So my question is - how do I implement rectOfSize
in the initialiser for STGridNode
? I've tried:
init(rectOfSize: CGPoint) {
super.init(rectOfSize: rectOfSize);
}
But that gives an error: 'Could not find an overload for init that accepts the supplied arguments'