healthkitlisted
Install: claude install-skill thienqo/ios-skills
# HealthKit
Access, query, and store health and fitness metrics in Apple Health using `HealthKit`. Covers authorization, quantity samples, statistics collection queries, background delivery, and workout sessions. Targets Swift 6.4 / iOS 26+.
## Contents
- [Capabilities and Privacy](#capabilities-and-privacy)
- [Availability and HKHealthStore](#availability-and-hkhealthstore)
- [Query Selection Matrix](#query-selection-matrix)
- [Writing Samples and Units](#writing-samples-and-units)
- [Route by Task](#route-by-task)
- [iOS 27 Updates](#ios-27-updates)
- [Common Mistakes](#common-mistakes)
- [Review Checklist](#review-checklist)
- [References](#references)
## Capabilities and Privacy
Enable **HealthKit** in Signing & Capabilities. If your app observes updates in the background, enable the **Background Delivery** checkbox.
Declare usage descriptions in `Info.plist`:
- `NSHealthShareUsageDescription`: Required for reading health data.
- `NSHealthUpdateUsageDescription`: Required for writing health data.
- `NSHealthClinicalHealthRecordsShareUsageDescription`: Required if accessing clinical records.
> [!IMPORTANT]
> Request only the exact types needed for the immediate feature. App Review strictly rejects apps requesting unneeded health permissions.
## Availability and HKHealthStore
Always guard initialization with `HKHealthStore.isHealthDataAvailable()`. HealthKit is supported on iPhone, Apple Watch, iPad (iPadOS 17+), and Vision Pro, but unavailable on iPadOS 16 or earl