---
title: "setFrameSize(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/setframesize(_:)"
---

# setFrameSize(_:)

Sets the size of the view’s frame rectangle to the specified dimensions, resizing it within its superview without affecting its coordinate system.

## Declaration

```swift
func setFrameSize(_ newSize: NSSize)
```

## Parameters

- `newSize`: An NSSize structure specifying the new height and width of the frame rectangle.

## Discussion

Discussion Changing the frame does not mark the view as needing to be displayed. Set the needsDisplay property to true when you want the view to be redisplayed. Changing the frame size results in the posting of an frameDidChangeNotification to the default notification center if the view is configured to do so. In macOS 10.4 and later, you can override this method to support content preservation during live resizing. In your overridden implementation, include some conditional code to be executed only during a live resize operation. Your code must invalidate any portions of your view that need to be redrawn.

## See Also

### Modifying the Frame Rectangle

- [frame](appkit/nsview/frame.md)
- [setFrameOrigin(_:)](appkit/nsview/setframeorigin(_:).md)
- [frameRotation](appkit/nsview/framerotation.md)
- [frameDidChangeNotification](appkit/nsview/framedidchangenotification.md)
- [postsFrameChangedNotifications](appkit/nsview/postsframechangednotifications.md)
