I would like to extend SCNNode (if possible) in Swift. Here is my attempt:
class MyNode : SCNNode {
override init(geometry: SCNGeometry) -> SCNNode {
return super.init(geometry)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
The → operator is marked with the error "Consecutive declarations in a line must be separated by the symbol" ".
I know this is wrong, but if I use Xcode's humor, it “fixes” it like this:
override init(geometry: SCNGeometry); -> SCNNode {
This is nonsense, and then Xcode complains about "Expected Expression."
I do not quite understand the implementation of SCNNode - if I look at it in Xcode, it is declared abstract (in the comments) and does not offer an implementation. The docs don't assume that anything comes out of SCNNode, you create it directly, so I assume I should extend it.
source
share