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.
Topic:
App & System Services
SubTopic:
Health & Fitness