<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Scene/defaultSize(width:height:depth:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ScenePAAE11defaultSize5width6height5depth2inQr14CoreFoundation7CGFloatV_A2KSo12NSUnitLengthCtF"
  },
  "title" : "defaultSize(width:height:depth:in:)"
}
-->

# defaultSize(width:height:depth:in:)

Sets a default size for a volumetric window.

```
nonisolated func defaultSize(width: CGFloat, height: CGFloat, depth: CGFloat, in unit: UnitLength) -> some Scene
```

## Parameters

`width`

The default width for the created window.

`height`

The default height for the created window.

`depth`

The default depth for the created volumetric window.

`unit`

The unit of length the dimensions of the window are specified in.

## Return Value

A scene that uses a default size for new windows.

## Discussion

Use this modifier to indicate the default initial size for a new 3D
window created from a [`Scene`](/documentation/SwiftUI/Scene) using [`VolumetricWindowStyle`](/documentation/SwiftUI/VolumetricWindowStyle):

```
WindowGroup {
    ContentView()
}
.windowStyle(.volumetric)
.defaultSize(width: 1, height: 1, depth: 0.5, in: .meters)
```

Each parameter is specified in the unit you provide. The size of a volumetric
scene is immutable after creation.

This modifier affects only windows that have the volumetric style in visionOS.

---

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)