<!--
{
  "availability" : [
    "iOS: 8.0.0 - 18.0.0",
    "iPadOS: 8.0.0 - 18.0.0",
    "macCatalyst: 13.0.0 - 18.0.0",
    "macOS: 13.0.0 - 15.0.0",
    "visionOS: 1.0.0 - 2.0.0",
    "watchOS: 2.0.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuery/predicateForWorkouts(with:totalEnergyBurned:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuery(cm)predicateForWorkoutsWithOperatorType:totalEnergyBurned:"
  },
  "title" : "predicateForWorkouts(with:totalEnergyBurned:)"
}
-->

# predicateForWorkouts(with:totalEnergyBurned:)

Returns a predicate for matching workouts based on the total energy burned.

```
class func predicateForWorkouts(with operatorType: NSComparisonPredicate.Operator, totalEnergyBurned: HKQuantity) -> NSPredicate
```

## Parameters

`operatorType`

The operator type to use when comparing the total energy burned.

`totalEnergyBurned`

The target amount of energy burned.

## Return Value

A predicate for matching workouts based on the total energy burned. This predicate works only on workouts.

## Discussion

Use this convenience method to create a predicate that matches against a workout’s total energy burned. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

```objc
// Predicate matching workouts burning 500 calories or more
HKQuantity *energyBurned =
[HKQuantity quantityWithUnit:[HKUnit kilocalorieUnit] doubleValue:500];
 
NSPredicate *workout =
    [HKQuery predicateForWorkoutsWithOperatorType:
     NSGreaterThanOrEqualToPredicateOperatorType
     totalEnergyBurned:energyBurned];
 
NSPredicate *explicitWorkout =
[NSPredicate predicateWithFormat:@"%K >= %@",
 HKPredicateKeyPathWorkoutTotalEnergyBurned,
 energyBurned];
```

## See Also

[`HKPredicateKeyPathWorkoutTotalEnergyBurned`](/documentation/HealthKit/HKPredicateKeyPathWorkoutTotalEnergyBurned)

The key path for accessing the workout’s total energy burned.

[`totalEnergyBurned`](/documentation/HealthKit/HKWorkout/totalEnergyBurned)

The total active energy burned during the workout.



---

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)