<!--
{
  "availability" : [
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Scene/windowIdealSize(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ScenePAAE15windowIdealSizeyQrAA06WindoweF0VF"
  },
  "title" : "windowIdealSize(_:)"
}
-->

# windowIdealSize(_:)

Specifies how windows derived form this scene should determine their
size when zooming.

```
nonisolated func windowIdealSize(_ idealSize: WindowIdealSize) -> some Scene
```

## Parameters

`idealSize`

A value which determines how windows derived from
this scene should size themselves when zooming.

## Discussion

The default behavior will size the window to its maximum size, or the
bounds of the display, whichever is smaller. By overriding this
behavior, you can provide a size that is appropriate for the contents
of your window.

For example, you can define a window group where the window has an ideal
width of 800 points and an ideal height of 600 points:

```
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .frame(idealWidth: 800, idealHeight: 600)
        }
        .windowIdealSize(.fitToContent)
    }
}
```

---

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)