<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/aspectRatio",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindow(py)aspectRatio"
  },
  "title" : "aspectRatio"
}
-->

# aspectRatio

The window’s aspect ratio, which constrains the size of its frame rectangle to integral multiples of this ratio when the user resizes it.

```
var aspectRatio: NSSize { get set }
```

## Discussion

The size of the window’s frame rectangle is constrained to integral multiples of this ratio when the user resizes it. You can set an `NSWindow` object’s size to any ratio programmatically.

An `NSWindow` object’s aspect ratio and its resize increments are mutually exclusive attributes. In fact, setting one attribute cancels the setting of the other. For example, to cancel an established aspect ratio setting for an `NSWindow` object, you can set the [`resizeIncrements`](/documentation/AppKit/NSWindow/resizeIncrements) property with the width and height set to `1.0`:

```objc
myWindow.resizeIncrements = NSMakeSize(1.0,1.0);
```

The [`contentAspectRatio`](/documentation/AppKit/NSWindow/contentAspectRatio) property takes precedence over this property.

---

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)