<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/scaleUnitSquare(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)scaleUnitSquareToSize:"
  },
  "title" : "scaleUnitSquare(to:)"
}
-->

# scaleUnitSquare(to:)

Scales the view’s coordinate system so that the unit square scales to the specified dimensions.

```
func scaleUnitSquare(to newUnitSize: NSSize)
```

## Parameters

`newUnitSize`

An `NSSize` structure specifying the new unit size.

## Discussion

For example, a `newUnitSize` of (0.5, 1.0) causes the view’s horizontal coordinates to be halved, in turn doubling the width of its bounds rectangle. Note that scaling is performed from the origin of the coordinate system, (0.0, 0.0), not the origin of the bounds rectangle; as a result, both the origin and size of the bounds rectangle are changed. The frame rectangle remains unchanged.

This method does not redisplay the view or mark it as needing display. You must do this yourself by calling the  [`display()`](/documentation/AppKit/NSView/display()) method or setting the [`needsDisplay`](/documentation/AppKit/NSView/needsDisplay) property.

This method posts an [`boundsDidChangeNotification`](/documentation/AppKit/NSView/boundsDidChangeNotification) to the default notification center if the view is configured to do so.

## See Also

[`setBoundsSize(_:)`](/documentation/AppKit/NSView/setBoundsSize(_:))

Sets the size of the view’s bounds rectangle to specified dimensions, inversely scaling its coordinate system relative to its frame rectangle.



---

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)