I'm noobie in Swift. I can't figure out why this code:
class GameScene: SKScene, SKPhysicsContactDelegate {
var statements = Statements()
override func didMoveToView(view: SKView) {
runAction(SKAction.repeatActionForever(
SKAction.sequence([
SKAction.runBlock(addLabel(statements)),
SKAction.waitForDuration(2.0)
])
))
}
func addLabel(statements: Statements) {...}
}
Results to: Missing argument for parameter 'completion' in call
Yet another weird bug in the type checker. Because the type of self.addLabel(self.statements)
is not Void -> Void
it's Void
, the compiler assumed you were invoking another method somewhere else (where that somewhere else is, I have no clue. There's no method named runBlock(_:)
anywhere I can find). Try an explicit closure when stuff like this happens
class GameScene: SKScene {
var statements = Statements()
override func didMoveToView(view: SKView) {
runAction(SKAction.repeatActionForever(SKAction.sequence([
SKAction.runBlock({ self.addLabel(self.statements) }),
SKAction.waitForDuration(2.0)
])))
}
func addLabel(statements: Statements) -> Void { }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With