iosswiftsprite-kitskactioncompletionhandler

If an SKAction is removed, is the completion still run?


As in the title, if I remove an action using sprite.removeAllActions(), does the action's completion still get run?

Here is a basic code snippet to help show what I am asking:

import SpriteKit

/// The action to add
let action = SKAction.moveBy(x: 10, y: 20, duration: 1.0)

/// The sprite to apply the action to
let sprite = SKSpriteNode(color: .white, size: CGSize(width: 50, height: 50))

// Run the action
sprite.run(action) {
    // Completion
    print("Completion")
}

Solution

  • I just quickly tested it after not receiving an answer. I discovered that the completion does NOT run if the action has been removed.