Reputation: 12925
I'm converting a Sprikit App to Swift. But I have a problem to convert this method:
SKAction *releaseBalls = [SKAction sequence:@[[SKAction performSelector:@selector(createMyNode) onTarget:self],[SKAction waitForDuration:1] ]];
Is there any alternative code in Swift ? Thanks
Upvotes: 15
Views: 4595
Reputation: 13127
Although other solutions are generally preferred, future readers might like to know that performSelector
and other members of the same family are available as of Swift 2.
Upvotes: 0
Reputation: 17500
Try this out
class MyScene: SKScene {
func doAction() {
let releaseBalls = SKAction.sequence([
SKAction.runBlock(self.createMyNode),
SKAction.waitForDuration(1)
])
// run action
}
func createMyNode() {
// create the nodes
}
}
Upvotes: 16