---
title: "bestDetection(for:)"
framework: cinematic
role: symbol
role_heading: Instance Method
path: "cinematic/cnscript-1ispe/frame/bestdetection(for:)"
---

# bestDetection(for:)

The best detection to focus on in a frame among those within the given detection group.

## Declaration

```swift
func bestDetection(for detectionGroupID: CNDetectionGroupID) -> CNDetection?
```

## Parameters

- `detectionGroupID`: Associates related detections.

## Return Value

Return Value An object representing the best detection to focus on in a frame among those within the given detection group.

## Discussion

Discussion Some types of detections also include a detection group ID that associates related detections, such as a face and torso, of the same person.
