The HKActivitySummaryQuery is useful for apps that are interested in what the user has done each day, in regards to exercise, stand hours, active calories, etc… The query can be used to query a single day, or a range of days.
The easiest way to think about this query is to look at the activity ring, or a collection of activity rings as pictured here. Apple Watch owners will be very aware of what each ring represents. This class allows you to fetch the data that builds up this ring, but also pass it to the HKActivityRingView to represent those numbers in a familiar format to Apple Watch users. For those wanting to use the Apple Watch version of the ring, Apple also has made available WKInterfaceActivityRing.
This tutorial will focus on the query and fetching the data. We might touch upon the activity ring view in a future tutorial, but for now we will focus on executing the query to fetch the available data. [Read more…]