---
title: "predicateForActivitySummary(with:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkquery/predicateforactivitysummary(with:)"
---

# predicateForActivitySummary(with:)

Returns a predicate that matches the activity summary for the specified day.

## Declaration

```swift
class func predicateForActivitySummary(with dateComponents: DateComponents) -> NSPredicate
```

## Parameters

- `dateComponents`: Date components that uniquely identify the day as perceived by the user. This day may be longer or shorter than 24 hours (for example, if the user traveled across time zones). The date components must have a valid doc://com.apple.documentation/documentation/Foundation/NSDateComponents/calendar property.

## Return Value

Return Value A predicate for matching a single activity summary.

## Discussion

Discussion Use this convenience method to create a predicate that matches the activity summary for the specified day. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

## See Also

### Related Documentation

- [HKPredicateKeyPathDateComponents](healthkit/hkpredicatekeypathdatecomponents.md)

### Creating activity summary predicates

- [predicate(forActivitySummariesBetweenStart:end:)](healthkit/hkquery/predicate(foractivitysummariesbetweenstart:end:).md)
