healthkit

Read, write, and query HealthKit data from the Apple Health store.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill healthkit-dfly7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: healthkit
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/healthkit
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill healthkit-dfly7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

HealthKit data is central to many health-focused apps, and securely reading, writing, and querying this data requires careful authorization and pattern usage. This guide provides structured approaches to access the Apple Health store, manage permissions, and perform common data operations at scale.

Core Features & Use Cases

  • Authorization: request and manage read/write permissions via HKHealthStore.
  • Data access: perform sample, statistics, anchored, and time-series queries to support dashboards and workouts.
  • Workout support: create and manage live workout sessions with HKWorkoutSession and HKLiveWorkoutBuilder, including background updates.
  • SwiftUI integration: lightweight patterns to integrate HealthKit in SwiftUI apps with observable health managers.

Quick Start

Start by requesting HealthKit authorization for the data you need and then fetch today’s steps and latest heart rate data.

Frequently Asked Questions about healthkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I request HealthKit authorization in a Swift iOS app?

You configure HKHealthStore and request specific read/write permissions for health data types before performing queries or saving workout data. This authorization workflow is required for secure access.

What's the best way to query HealthKit statistics data in Swift 6?

The best way to query HealthKit statistics is using HKStatisticsQueryDescriptor to retrieve aggregated health data from the Apple Health store. This modern Swift approach handles statistics queries efficiently.

Can I save workout data to HealthKit using HKLiveWorkoutBuilder?

Yes, you can save workout data using HKLiveWorkoutBuilder and HKWorkoutSession to create and manage live workout sessions with background updates directly to the Apple Health store.

How do I fetch today's steps and latest heart rate from HealthKit?

You fetch today's steps and latest heart rate by requesting HealthKit authorization and then using query descriptors like HKSampleQueryDescriptor to retrieve the specific health data from HKHealthStore.

Do I need HealthKit entitlements to read and write health data?

Yes, you need appropriate HealthKit entitlements configured in your iOS app to securely read, write, and query health data from the Apple Health store using HKHealthStore.

How do I integrate HealthKit queries with SwiftUI?

You integrate HealthKit with SwiftUI by using observable health managers to fetch data via query descriptors and update views reactively. This provides lightweight patterns for data access.