A query for read activity summary objects from the HealthKit store.
Activity summary query objects are mostly immutable. You can assign the query’s updateHandler property after instantiating the object. All other properties must be set when you instantiate the object, and they cannot change.
Executing Activity Summary Queries
The sample code, shown below, builds and executes a query that returns the activity summaries for the previous week.
This code performs the following steps:
Creates the date component objects representing the start and end days, as perceived by the user.
Creates a predicate object using the date components.