Get notified of a property change on your node subclass and retrieve the amount of change.
Generally, actions do not call public methods on nodes. For example, if you want to subclass
SKNode to respond to a
move action, you might consider overriding its
position property to add a
did observer (see Overriding Property Observers).
However, because a move action that's running on an instance of
Moving (defined in the code listing above) doesn't set its position, the observer isn't invoked and thus, your code is never executed.
In this case, the solution is to use
SKScene and compare the node's position across two of its callbacks. You save the node's initial position in
update:, which is called at the beginning of each frame, then calculate any change in position in
did, which is called after actions have been evaluated.
The following code demonstrates an example of this strategy: