---
title: "init(contentRect:styleMask:backing:defer:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nswindow/init(contentrect:stylemask:backing:defer:)"
---

# init(contentRect:styleMask:backing:defer:)

Initializes the window with the specified values.

## Declaration

```swift
init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool)
```

## Parameters

- `contentRect`: Origin and size of the window’s content area in screen coordinates. Note that the window server limits window position coordinates to ±16,000 and sizes to 10,000.
- `style`: The window’s style. It can be NSBorderlessWindowMask, or it can contain any of the options described in doc://com.apple.appkit/documentation/AppKit/NSWindow/StyleMask-swift.struct, combined using the C bitwise OR operator. Borderless windows display none of the usual peripheral elements and are generally useful only for display or caching purposes; you should normally not need to create them. Also, note that a window’s style mask should include NSTitledWindowMask if it includes any of the others.
- `backingStoreType`: Specifies how the drawing done in the window is buffered by the window device, and possible values are described in doc://com.apple.appkit/documentation/AppKit/NSWindow/BackingStoreType.
- `flag`: Specifies whether the window server creates a window device for the window immediately. When doc://com.apple.documentation/documentation/Swift/true, the window server defers creating the window device until the window is moved onscreen. All display messages sent to the window or its views are postponed until the window is created, just before it’s moved onscreen.

## Return Value

Return Value The initialized window.

## Discussion

Discussion This method is the designated initializer for the NSWindow class. Deferring the creation of the window improves launch time and minimizes the virtual memory load on the window server. The new window creates a view to be its default content view. You can replace it with your own object by setting the contentView property. warning: Swift and Automatic Reference Counting (ARC) clients need to set the isReleasedWhenClosed property to false to avoid releasing the window too many times.

## See Also

### Related Documentation

- [isOneShot](appkit/nswindow/isoneshot.md)
- [orderFront(_:)](appkit/nswindow/orderfront(_:).md)
- [NSWindow](appkit/nswindow.md)

### Creating a Window

- [init(contentViewController:)](appkit/nswindow/init(contentviewcontroller:).md)
- [init(contentRect:styleMask:backing:defer:screen:)](appkit/nswindow/init(contentrect:stylemask:backing:defer:screen:).md)
