<!--
{
  "availability" : [
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/WindowIdealSize",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI15WindowIdealSizeV"
  },
  "title" : "WindowIdealSize"
}
-->

# WindowIdealSize

A type which defines the size a window should use when zooming.

```
struct WindowIdealSize
```

## Overview

Use this type in conjunction with the `Scene.windowIdealSize(_:)` modifier
to override the default behavior for how windows behave when performing a
zoom.

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)
    }
}
```

## Topics

### Type Properties

[`static let automatic: WindowIdealSize`](/documentation/SwiftUI/WindowIdealSize/automatic)

The automatic window ideal size. Windows will use the system behavior
when determining the size to use when zooming.

[`static let fitToContent: WindowIdealSize`](/documentation/SwiftUI/WindowIdealSize/fitToContent)

A window ideal size which uses the ideal size of the window’s contents.

[`static let maximum: WindowIdealSize`](/documentation/SwiftUI/WindowIdealSize/maximum)

A window ideal size which uses the maximum size of the
window’s contents.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)