Type identifiers used for tracking diet and nutrition.
Nutritional data can be broadly categorized into two main groups:
Macronutrients consumed in large quantities, such as fats, carbohydrates, and proteins.
Micronutrients consumed in smaller quantities, such as vitamins and minerals.
HealthKit also provides type identifiers for nutrition-related items that users may want to track, like water or caffeine.
You do not need to track all nutritional information; you can focus on the items of interest to your users. In general, the data from nutrition labels is a good place to start. Many countries require a nutrition label on packaged food. While the contents of these labels vary from country to country, they typically include the nutritional data represented by these properties:
Combine Nutritional Samples
Macronutrient identifiers can be thought of as a hierarchy. The
dietary identifier represents the total amount of energy from all fats, carbohydrates, and protein. You can provide a detailed breakdown using the
dietary identifiers. Fats can be further separated into
dietary. Carbohydrates can be identified as
Unless your app is very focused (for example, tracking only sugar or saturated fat), always provide the total data (
dietary), and then optionally provide the more detailed information using the subcategories. You do not need to provide data for all of the subcategories; however, the sum of the subcategory sample values should be equal or less than the total sample’s value.