Healthkit

HealthKit: HKHealthStore, authorization, reading/writing health data, queries. Use when implementing app features related to healthkit.

abdullah4ai 66c9fa5 664 B Updated

File contents

Healthkit

HEALTHKIT:

  • import HealthKit; HKHealthStore()
  • Check availability: HKHealthStore.isHealthDataAvailable()
  • Request auth: healthStore.requestAuthorization(toShare:read:)
  • Requires NSHealthShareUsageDescription + NSHealthUpdateUsageDescription (add CONFIG_CHANGES)
  • Requires com.apple.developer.healthkit entitlement (add CONFIG_CHANGES)
  • Query: HKSampleQuery, HKStatisticsQuery for aggregated data
  • Common types: HKQuantityType(.stepCount), .heartRate, .activeEnergyBurned

abdullah4ai/apple-dev-docs/tree/main/swiftship/internal/skills/data/features/healthkit commit 66c9fa5bae

Frequently asked questions

npx skillmds@latest add abdullah4ai/healthkit