Know when all SKActions are complete or there aren't any running

animation, cocoa-touch, ios, skaction, sprite-kit

Solution

To my knowledge there is no way to do this via the default framework capabilities.

However, I think you could achieve something like this by creating a class with methods that act as a wrapper for calling `SKAction runAction:` on a node.

In that wrapper method, you could push the node into an array, and then append a `performSelector` action to each action/group/sequence. So whatever method you specify gets called after completion of the action/group/sequence. When that method is called, you can just remove that node from the array.

With this implementation you would always have an array of all nodes that currently have an action running on them. If the array is empty, none are running.

Problem

I have a number of `SKActions` running on various nodes. How can I know when they are all completed? I want to ignore touches while animations are running. If I could somehow run actions in parallel on a number of nodes, I could wait for a final action to run, but I don't see any way to coordinate actions across nodes. I can fake this by running through all the scene's children and checking for `hasActions` on each child. Seems a little lame, but it does work.

Original source