Class

HKObserverQuery

A long-running query that monitors the HealthKit store and updates your app when the HealthKit store saves or deletes a matching sample.

Declaration

class HKObserverQuery : HKQuery

Overview

Observer queries set up a long-running task on a background queue. This task watches the HealthKit store, and alerts you when the store saves or removes matching data. Your app uses observer queries to respond to changes made by other apps and devices.

Observer queries are immutable: You set their properties when you first create them, and you can’t change them.

Topics

Creating Observer Queries

Executing Observer Queries

Create and run observer queries.

typealias HKObserverQueryCompletionHandler

The completion handler for background deliveries.

Relationships

Inherits From

Conforms To

See Also

Common Query Types

class HKSampleQuery

A general query that returns a snapshot of all the matching samples currently saved in the HealthKit store.

class HKQuantitySeriesSampleQuery

A query that accesses the series data associated with a quantity sample.

class HKAnchoredObjectQuery

A query that returns changes to the HealthKit store, including a snapshot of new changes and continuous monitoring as a long-running query.

class HKCorrelationQuery

A query that performs complex searches based on the correlation’s contents, and returns a snapshot of all matching samples.

class HKDocumentQuery

A query that returns a snapshot of all matching documents currently saved in the HealthKit store.

class HKHeartbeatSeriesQuery

A query that returns the heartbeat data contained in a heartbeat series sample.

class HKQuery

An abstract class for all the query classes in HealthKit.