SpriteKit: run code or block when activity is removed?
The functionrun
for SKNode
allows you to start the block when the action finishes, but what if the action is canceled / removed viaremoveAllActions?
Canceling an action does not call a completion block from within the function run
.
Is there a callback or a way to run the code when the action is canceled / removed?
source to share
Yes, if you delete an activity before it completes, the completion block will not run. Per Docs:
The run (: completion :) method is identical to the run (:) method, but when the action completes, your block is called. This callback is only called if the activity completes. If an activity is removed before it completes, the completion handler is never called.
source to share