---
title: "predicateForWorkouts(with:totalFlightsClimbed:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkquery/predicateforworkouts(with:totalflightsclimbed:)"
---

# predicateForWorkouts(with:totalFlightsClimbed:)

Returns a predicate that matches workout samples based on the number of flights climbed.

## Declaration

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

## Parameters

- `operatorType`: The operator to use when comparing the sample to the target number of flights climbed.
- `totalFlightsClimbed`: A quantity representing the target number of flights climbed.

## Return Value

Return Value A predicate that matches workouts based on the number of flights climbed.

## Discussion

Discussion This convenience method creates a predicate that compares the total flights climbed during a workout with a target number of flights climbed. The following sample uses the convenience method and a predicate format string to create equivalent predicates. let flightsClimbed = HKQuantity(unit: HKUnit.count(), doubleValue: 10.0) let tenFlightsClimbed = HKQuery.predicateForWorkouts(with: .greaterThanOrEqualTo, totalFlightsClimbed: flightsClimbed)

// Creating a predicate using a predicate format string. let explicitTenFlightsClimbed = NSPredicate(format: "%K >= %@",                                             HKPredicateKeyPathWorkoutTotalFlightsClimbed,                                             flightsClimbed)

## See Also

### Related Documentation

- [HKPredicateKeyPathWorkoutTotalFlightsClimbed](healthkit/hkpredicatekeypathworkouttotalflightsclimbed.md)

### Creating workout predicates

- [predicateForObjects(from:)](healthkit/hkquery/predicateforobjects(from:)-5irg9.md)
- [predicateForWorkouts(with:)](healthkit/hkquery/predicateforworkouts(with:).md)
- [predicateForWorkouts(activityPredicate:)](healthkit/hkquery/predicateforworkouts(activitypredicate:).md)
- [predicateForWorkouts(with:duration:)](healthkit/hkquery/predicateforworkouts(with:duration:).md)
- [predicateForWorkouts(operatorType:quantityType:averageQuantity:)](healthkit/hkquery/predicateforworkouts(operatortype:quantitytype:averagequantity:).md)
- [predicateForWorkouts(operatorType:quantityType:maximumQuantity:)](healthkit/hkquery/predicateforworkouts(operatortype:quantitytype:maximumquantity:).md)
- [predicateForWorkouts(operatorType:quantityType:minimumQuantity:)](healthkit/hkquery/predicateforworkouts(operatortype:quantitytype:minimumquantity:).md)
- [predicateForWorkouts(operatorType:quantityType:sumQuantity:)](healthkit/hkquery/predicateforworkouts(operatortype:quantitytype:sumquantity:).md)
- [predicateForWorkouts(with:totalDistance:)](healthkit/hkquery/predicateforworkouts(with:totaldistance:).md)
- [predicateForWorkouts(with:totalEnergyBurned:)](healthkit/hkquery/predicateforworkouts(with:totalenergyburned:).md)
- [predicateForWorkouts(with:totalSwimmingStrokeCount:)](healthkit/hkquery/predicateforworkouts(with:totalswimmingstrokecount:).md)
