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

# predicateForWorkouts(with:)

Returns a predicate for matching workouts based on the type of activity.

```
class func predicateForWorkouts(with workoutActivityType: HKWorkoutActivityType) -> NSPredicate
```

## Parameters

`workoutActivityType`

The type of activity. For a list of valid workout activities, see [`HKWorkoutActivityType`](/documentation/HealthKit/HKWorkoutActivityType).

## Return Value

A predicate for matching workouts based on the type of activity.

## Discussion

Use this convenience method to create a predicate that matches workouts based on their activity. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

```objc
NSPredicate *workout =
    [HKQuery predicateForWorkoutsWithWorkoutActivityType:
     HKWorkoutActivityTypeCurling];
 
NSPredicate *explicitWorkout =
[NSPredicate predicateWithFormat:@"%K == %d",
 HKPredicateKeyPathWorkoutType,
 HKWorkoutActivityTypeCurling];
```

## See Also

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

The type of activity performed during the workout.

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

The key path for accessing the workout’s type.



---

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)