---
title: "bestDepth(colorSpaceName:bitsPerSample:bitsPerPixel:isPlanar:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nswindow/depth/bestdepth(colorspacename:bitspersample:bitsperpixel:isplanar:)"
---

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

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

## Declaration

```swift
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

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

## See Also

### Accessing Depth Details

- [availableDepths](appkit/nswindow/depth/availabledepths.md)
- [bitsPerPixel](appkit/nswindow/depth/bitsperpixel.md)
- [bitsPerSample](appkit/nswindow/depth/bitspersample.md)
- [colorSpaceName](appkit/nswindow/depth/colorspacename.md)
- [isPlanar](appkit/nswindow/depth/isplanar.md)
