The goal is to animate multiple SCNNodes at the same time then call a completion block once all the animations complete. The parallel animations have the same duration so will complete at the same time if started together.
This SO answer suggested using the group
function for Sprite Kit, but there is no analog in Scene Kit because the SCNScene
class lacks a runAction
.
One option is run all the actions individually against each node and have each one call the same completion function, which must maintain a flag to ensure it's only called once.
Another option is to avoid the completion handler and call the completion code after a delay matched to the animation duration. This creates race conditions during testing, however, since sometimes the animations get held up before completing.
This seems clunky, though. What's the right way to group the animation of multiple nodes in SceneKit then invoke a completion handler?