HKStatisticsCollectionQuery or HKStatisticsCollectionQueryDescriptor

Hi, there seems to be two methods to fetch data from HealthKit and calculate statistics on intervals of the data; HKStatisticsCollectionQuery and HKStatisticsCollectionQueryDescriptor.

I am currently using HKStatisticsCollectionQuery, but HKStatisticsCollectionQueryDescriptor seems to do the same, but with very different code setup. Could anyone provide any advice on which method is preferable? Will the older HKStatisticsCollectionQuery become obsolete in the near future?

Thanks Tommy

Answered by snymainn in 818130022

I can answer this myself. After the introduction of the concurrency in Swift, the HKStatisticsCollectionQueryDescriptor seems the method to use. Completion statement and HKStatisticsCollectionQuery is dated and harder to implement.

Accepted Answer

I can answer this myself. After the introduction of the concurrency in Swift, the HKStatisticsCollectionQueryDescriptor seems the method to use. Completion statement and HKStatisticsCollectionQuery is dated and harder to implement.

HKStatisticsCollectionQuery or HKStatisticsCollectionQueryDescriptor
 
 
Q