---
title: "objects(for:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkcorrelation/objects(for:)"
---

# objects(for:)

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

## Declaration

```swift
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 doc://com.apple.healthkit/documentation/HealthKit/HKSampleType object created with the doc://com.apple.healthkit/documentation/HealthKit/HKQuantityTypeIdentifier/dietaryEnergyConsumed identifier.

## Return Value

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

## See Also

### Getting Correlation Data

- [correlationType](healthkit/hkcorrelation/correlationtype.md)
- [objects](healthkit/hkcorrelation/objects.md)
