Reputation: 591
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".
func randomCGFloat() -> CGFloat {
var temp = CGFloat(arc4random_uniform(UInt32(10)))/10
println(temp)
return temp
}
Upvotes: 1
Views: 144
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