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

# useOptimizedDrawing(_:)

Specifies whether the window is to optimize focusing and drawing when displaying its views.

```
func useOptimizedDrawing(_ flag: Bool)
```

## Parameters

`flag`

If <doc://com.apple.documentation/documentation/Swift/true>, the window will optimize focusing and drawing for its views; if <doc://com.apple.documentation/documentation/Swift/false>, it will not, in which case, the window does not preserve the Z-ordering of overlapping views when an object explicitly sends [`lockFocus()`](/documentation/AppKit/NSView/lockFocus()) to a view and draws directly to it, instead of using the AppKit standard display mechanism.

## Discussion

The optimizations may prevent sibling subviews from being displayed in the correct order—which matters only if the subviews overlap. You should always set `flag` to <doc://com.apple.documentation/documentation/Swift/true> when there are no overlapping subviews within the window. The default is <doc://com.apple.documentation/documentation/Swift/false>.

---

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)