<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKNode/calculateAccumulatedFrame()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKNode(im)calculateAccumulatedFrame"
  },
  "title" : "calculateAccumulatedFrame()"
}
-->

# calculateAccumulatedFrame()

Returns a rectangle in the parent’s coordinate system that contains the position and size of itself and all child nodes.

```
func calculateAccumulatedFrame() -> CGRect
```

## Discussion

The frame takes into the account the cumulative effect of the [`xScale`](/documentation/SpriteKit/SKNode/xScale), [`yScale`](/documentation/SpriteKit/SKNode/yScale), and [`zRotation`](/documentation/SpriteKit/SKNode/zRotation) properties of each node in the subtree.

Listing 1 shows, in Swift, how [`calculateAccumulatedFrame()`](/documentation/SpriteKit/SKNode/calculateAccumulatedFrame()) can be used display the bounding box of a shape node. The child node, although smaller than its parent, is rotated by 30° so that its bounds extend beyond its parent’s bounds. After `childNode` has been added to `parentNode`, a further shape node, `boundingBoxNode`, is created with its size based on the accumulated frame of parentNode.

Listing 1. Displaying the accumulated frame of a shape node

```swift
let parentNode = SKShapeNode(rectOf: CGSize(width: 500, height: 500))
parentNode.lineWidth = 2
parentNode.strokeColor = .blue
parentNode.fillColor = .clear
     
let childNode = SKShapeNode(rectOf: CGSize(width: 400, height: 400))
childNode.strokeColor = .red
childNode.fillColor = .clear
childNode.zRotation = -CGFloat.pi / 6 // pi / 6 = 30°
     
parentNode.addChild(childNode)
     
let boundingBoxNode = SKShapeNode(rectOf: parentNode.calculateAccumulatedFrame().size)
boundingBoxNode.lineWidth = 1
boundingBoxNode.strokeColor = .black
boundingBoxNode.fillColor = .clear
boundingBoxNode.path = boundingBoxNode.path?.copy(dashingWithPhase: 0,
                                                  lengths: [10,10])
     
parentNode.addChild(boundingBoxNode)
```

The figure below shows the result of Listing 1 with `parentNode` rendered in blue, `childNode` rendered in red and the `boundingBoxNode` rendered with a dashed line.

![Displaying the accumulated frame of a shape node](images/com.apple.spritekit/media-2793217@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)