---
title: "setFrame(from:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindow/setframe(from:)"
---

# setFrame(from:)

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

## Declaration

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

## Parameters

- `string`: A string representation of a frame rectangle, previously accessed using doc://com.apple.appkit/documentation/AppKit/NSWindow/frameDescriptor.

## Discussion

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:) message to be sent to the delegate.

## See Also

### Managing Window Frames in User Defaults

- [removeFrame(usingName:)](appkit/nswindow/removeframe(usingname:).md)
- [setFrameUsingName(_:)](appkit/nswindow/setframeusingname(_:).md)
- [setFrameUsingName(_:force:)](appkit/nswindow/setframeusingname(_:force:).md)
- [saveFrame(usingName:)](appkit/nswindow/saveframe(usingname:).md)
- [setFrameAutosaveName(_:)](appkit/nswindow/setframeautosavename(_:).md)
- [frameAutosaveName](appkit/nswindow/frameautosavename-swift.property.md)
- [NSWindow.FrameAutosaveName](appkit/nswindow/frameautosavename-swift.typealias.md)
- [frameDescriptor](appkit/nswindow/framedescriptor.md)
- [NSWindow.PersistableFrameDescriptor](appkit/nswindow/persistableframedescriptor.md)
