---
title: "joint(withBodyA:bodyB:anchorA:anchorB:)"
framework: spritekit
role: symbol
role_heading: Type Method
path: "spritekit/skphysicsjointspring/joint(withbodya:bodyb:anchora:anchorb:)"
---

# joint(withBodyA:bodyB:anchorA:anchorB:)

Creates a new spring joint.

## Declaration

```swift
class func joint(withBodyA bodyA: SKPhysicsBody, bodyB: SKPhysicsBody, anchorA: CGPoint, anchorB: CGPoint) -> SKPhysicsJointSpring
```

## Parameters

- `bodyA`: The first body to connect. The body must be connected to a node that is already part of the scene’s node tree.
- `bodyB`: The second body to connect. The body must be connected to a node that is already part of the scene’s node tree.
- `anchorA`: The connection point on the first body in the scene’s coordinate system.
- `anchorB`: The connection point on the second body in the scene’s coordinate system.

## Return Value

Return Value A new spring joint.

## Discussion

Discussion You must add the joint to a physics world associated with the scene before it takes effect.
