A view that uses the Move, Exercise, and Stand activity rings to display data from a HealthKit activity summary object.
- iOS 9.3+
HKActivity to display data from an
HKActivity object. For example, Figure 1 shows how the rings can display a summary view of the user's activity.
The activity ring view always appears as a black rectangle with red, green, and blue concentric rings. The rings are centered in the view and are sized to fit the available space (see Figure 2).
The rings have two different ways to display a lack of data. One indicates that the activity summary is missing, and the other indicates that the activity summary’s values are set to zero. If the ring has a
activity property, the rings appear empty. Use this to indicate that there is no summary data available for the specified day (for example, dates in the future).
If the summary has zero-valued quantities set for its value properties, the ring displays a dot at the top of the ring. Use this to indicate that the user has not yet burned any active calories, exercised, or earned any stand hours for the specified day.
To display data for a ring, the
HKActivity object must have a non-
nil quantity for both the corresponding value property and the goal property (see Table 1).
The activity ring view colors a percentage of each ring based on these properties, as shown here: