<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Cinematic",
  "identifier" : "/documentation/Cinematic/CNScript-1ispe/Frame/bestDetection(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Cinematic"
    ],
    "preciseIdentifier" : "s:9Cinematic8CNScriptC5FrameV13bestDetection3forAA11CNDetectionVSgSo0G7GroupIDa_tF"
  },
  "title" : "bestDetection(for:)"
}
-->

# bestDetection(for:)

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

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

## Parameters

`detectionGroupID`

Associates related detections.

## Return Value

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

## 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.

---

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)