I am developing a SpriteKit game which uses a joystick. I have created a joystick SKNode Class.
The code for the class:
import Foundation
import SpriteKit
class Joystick: SKNode {
var joystickPad: SKShapeNode!
var joystickStick: SKShapeNode!
var colour: UIColor!
init(colour: UIColor) {
//constructor method
self.colour = colour;
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// lots of other code unrelated to the error
}
I got the following error when I run my code:
Super.init isn't called on all paths before returning from initializer
Can anyone please explain the error and tell me any solutions, I don't get why I'm getting that error, as I thought my class was just a class not a superclass.
Any Help would be much appreciated.
Additional Info:
I'm using:
- Swift 4
- Spritekit
- Xcode 9.2
- iPhone 6s Running the latest public release iOS