blue
blue

Reputation: 7375

Swift error with repeatActionForever: "missing argument for parameter 'completion'"?

So I'm trying to have a sequence be executed forever, and the sequence works fine on its own; I just can't get it to run within repeatActionForever:

runAction(SKAction.repeatActionForever(
            block1.runAction(SKAction.sequence([
            moveDownLeft,
            SKAction.runBlock({ self.block1.hidden = true}),
            moveUpLeft,
            SKAction.runBlock({ self.block1.hidden = false})])
            ))) 

I get this error on the first line: "missing argument for parameter 'completion' in call". What's going wrong here?

Upvotes: 0

Views: 454

Answers (1)

rakeshbs
rakeshbs

Reputation: 24572

block1.runAction does not return an SKAction. It just performs the SKAction.If you are trying to create an SKAction that will run forever with the sequenced SKAction in your array, then remove the block1.runAction part

runAction(SKAction.repeatActionForever(SKAction.sequence([
     moveDownLeft,
     SKAction.runBlock({
         self.block1.hidden = true
     }),
     SKAction.runBlock({
         self.block1.hidden = false
     }),
     moveUpLeft
     ])))

Upvotes: 2

Related Questions