A joint that simulates a spring connecting two physics bodies.
An SKPhysicsJointSpring object simulates connecting two physics bodies together with a spring. The farther the two objects move from each other, the more force is applied to bring the two bodies back together.
Listing 1 shows how you can create a spring joint between sprite nodes. The physics body of staticNode has its isDynamic property set to false, preventing it from being affected by gravity. It is animated with an SKAction to move it upwards.
dynamicNode is joined to staticNode with an SKPhysicsJointSpring named spring, with a frequency of 0.5 and a damping of 0.2.
The final result is that as staticNode moves vertically, dynamicNode follows the upward path with a slight delay and bounce.