user3673836
user3673836

Reputation: 591

SKAction.runBlock -> missing argument for completion in call

I'm quite new to Swift. I'm trying to run a block of animation code forever. What am I doing wrong here? It keeps complaining about "missing argument for completion in call".

enter image description here

func randomCGFloat() -> CGFloat {
    var temp = CGFloat(arc4random_uniform(UInt32(10)))/10
    println(temp)
    return temp
}

Upvotes: 1

Views: 144

Answers (1)

lchamp
lchamp

Reputation: 6612

You're not trying to run a block of code but simply run an action.

In your case you should be able to do like so :

let fadeAction = SKAction.fadeAlphaBy(self.randomCGFloat(), duration: 0.3)
let repeatAction = SKAction.repeatActionForever(fadeAction)

gameFieldMask.runAction(repeatAction)

Or in one line if you prefer :

gameFieldMask.runAction(SKAction.repeatActionForever(SKAction.fadeAlphaBy(self.randomCGFloat(), duration: 0.3)))

Upvotes: 1

Related Questions