---
title: aspectRatio
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nswindow/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.

## Declaration

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

## Discussion

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 property with the width and height set to 1.0: myWindow.resizeIncrements = NSMakeSize(1.0,1.0); The contentAspectRatio property takes precedence over this property.

## See Also

### Sizing Windows

- [frame](appkit/nswindow/frame.md)
- [setFrameOrigin(_:)](appkit/nswindow/setframeorigin(_:).md)
- [setFrameTopLeftPoint(_:)](appkit/nswindow/setframetopleftpoint(_:).md)
- [constrainFrameRect(_:to:)](appkit/nswindow/constrainframerect(_:to:).md)
- [cascadeTopLeft(from:)](appkit/nswindow/cascadetopleft(from:).md)
- [setFrame(_:display:)](appkit/nswindow/setframe(_:display:).md)
- [setFrame(_:display:animate:)](appkit/nswindow/setframe(_:display:animate:).md)
- [animationResizeTime(_:)](appkit/nswindow/animationresizetime(_:).md)
- [minSize](appkit/nswindow/minsize.md)
- [maxSize](appkit/nswindow/maxsize.md)
- [isZoomed](appkit/nswindow/iszoomed.md)
- [performZoom(_:)](appkit/nswindow/performzoom(_:).md)
- [zoom(_:)](appkit/nswindow/zoom(_:).md)
- [resizeFlags](appkit/nswindow/resizeflags.md)
- [resizeIncrements](appkit/nswindow/resizeincrements.md)
