What problem does it solve?
Integrates HealthKit patterns and best practices to reliably read, write, observe, and display health and workout data while handling authorization, entitlements, and background delivery constraints.
Core Features & Use Cases
- Authorization & Entitlements: Guidance for requesting NSHealthShareUsageDescription / NSHealthUpdateUsageDescription and enabling HealthKit capabilities and background delivery.
- Reading & Aggregation: Recipes for one-time reads, aggregated statistics, time-bucketed collections, and incremental sync with anchored queries.
- Real-time & Background: Use HKObserverQuery, enableBackgroundDelivery, and persist anchors to support background updates and efficient incremental sync.
- Workout Support: Patterns for HKWorkoutSession, HKWorkoutBuilder, and HKLiveWorkoutBuilder to build, collect, and save workouts on watchOS, plus HealthKit UI patterns like Activity Ring integration.
- Use Case: Build an iOS/watchOS fitness feature that requests minimal permissions, streams live heart rate during workouts, persists anchors for sync, and displays activity summaries.
Quick Start
Use the healthkit skill to generate Swift code that requests authorization for steps and heart rate, enables background delivery, and fetches the latest heart rate samples.