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

# setFrame(from:)

Sets the window’s frame rectangle from a given string representation.

```
func setFrame(from string: NSWindow.PersistableFrameDescriptor)
```

## Parameters

`string`

A string representation of a frame rectangle, previously accessed using [`frameDescriptor`](/documentation/AppKit/NSWindow/frameDescriptor).

## Discussion

If the window is not resizable, this method will not resize the window. The frame is constrained according to the window’s minimum and maximum size settings. This method causes a [`windowWillResize(_:to:)`](/documentation/AppKit/NSWindowDelegate/windowWillResize(_:to:)) message to be sent to the delegate.

---

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)