Int vs Int.type Error

79 views Asked by At

I am making a game. When I tried to make a subclass (rifleman) of the superclass (character) of the superclass (SKNode), I got this error when typing out the super.init.

enter image description here

How do I turn the Int.type into an Int? Why is this error even coming up in the first place?

1

There are 1 answers

2
Ryan H. On BEST ANSWER

The initializer is expecting an actual Int value, not the Int type.

For example:

super.init(tag: 0, team: "string", currentAction: 0)

You do not have to convert an Int.type to an Int. You just need to provide the values that the initializer expects.

The compiler is presenting this error because it can determine based on the code you have written that the argument values have not been supplied in a manner that satisfies initializer's signature. If this error was not presented, your app would crash at runtime.