<!--
{
  "availability" : [
    "macOS: 10.9.0 -",
    "swift: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/Depth/bestDepth(colorSpaceName:bitsPerSample:bitsPerPixel:isPlanar:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "s:So13NSWindowDepthV6AppKitE04bestB014colorSpaceName13bitsPerSample0iJ5Pixel8isPlanarAB_Sb0M10ExactMatchtSo07NSColorgH0a_S2iSbtFZ"
  },
  "title" : "bestDepth(colorSpaceName:bitsPerSample:bitsPerPixel:isPlanar:)"
}
-->

# bestDepth(colorSpaceName:bitsPerSample:bitsPerPixel:isPlanar:)

Determines the best window depth that most closely matches the given properties.

```
static func bestDepth(colorSpaceName: NSColorSpaceName, bitsPerSample: Int, bitsPerPixel: Int, isPlanar: Bool) -> (NSWindow.Depth, isExactMatch: Bool)
```

## Parameters

`colorSpaceName`

The name of a color space to match.

`bitsPerSample`

The bits per sample to match.

`bitsPerPixel`

The bits per pixel to match.

`isPlanar`

A Boolean that indicates whether the window depth is planar.

## Return Value

The window depth that most closely matches the properties this function requests.

---

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)