<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKCorrelation/objects(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKCorrelation(im)objectsForType:"
  },
  "title" : "objects(for:)"
}
-->

# objects(for:)

Returns a set containing all the objects of the specified type in the correlation.

```
func objects(for objectType: HKObjectType) -> Set<HKSample>
```

## Parameters

`objectType`

The quantity or category type for the data stored inside the correlation. For example, to get all the samples measuring calories from inside a correlation, use an [`HKSampleType`](/documentation/HealthKit/HKSampleType) object created with the [`dietaryEnergyConsumed`](/documentation/HealthKit/HKQuantityTypeIdentifier/dietaryEnergyConsumed) identifier.

## Return Value

A set containing all the objects of the specified type in the correlation.

---

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)