Community-maintained Agent Skills for complete Swift and Apple-platform app delivery.
72
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Medium
Suggest reviewing before use
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.3 / iOS 26+.
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.
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 earlier and managed devices with restrictions.
guard HKHealthStore.isHealthDataAvailable() else { return }
let healthStore = HKHealthStore() // Single thread-safe shared store| Query Type | Best Used For | Execution |
|---|---|---|
HKSampleQueryDescriptor | Raw individual samples with sorting and limits | One-shot async |
HKStatisticsQueryDescriptor | Single aggregate metric (sum, average, min/max) over a date range | One-shot async |
HKStatisticsCollectionQueryDescriptor | Time-series aggregations (daily step charts, hourly heart rate) | One-shot or continuous |
HKAnchoredObjectQueryDescriptor | Incremental synchronization with anchor tokens | One-shot or streaming |
HKObserverQuery | Background delivery triggers when health data changes | Background notification |
Always specify compatible HKUnits matching the quantity type. For cumulative metrics (steps, active energy), set start and end dates encompassing the measurement interval; for discrete metrics (heart rate), use identical start and end dates.
enableBackgroundDelivery, read Background Delivery.HKWorkoutSession and HKLiveWorkoutBuilder, read Live Workout Sessions.HKHealthStore.isHealthDataAvailable().NSHealthShareUsageDescription or NSHealthUpdateUsageDescription, causing immediate crash on launch.HKHealthStore instances instead of sharing a single instance across the app..meter() instead of .count()).HKHealthStore.isHealthDataAvailable() checked before accessing storeHKQuantityType dimensionenableBackgroundDelivery(for:frequency:).tessl-plugin
skills
accessorysetupkit
references
activitykit
adattributionkit
references
alarmkit
references
app-clips
app-intents
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
audioaccessorykit
references
authentication
references
avfoundation-audio
references
avkit
background-processing
references
browserenginekit
callkit
references
carplay
cloudkit
contacts-framework
references
core-bluetooth
references
core-data
core-haptics
references
core-motion
references
core-nfc
references
coreml
references
cryptokit
cryptotokenkit
debugging-instruments
device-integrity
references
energykit
references
eventkit
family-controls
references
financekit
focus-engine
gamekit
git-branching-workflow
references
healthkit
references
homekit
references
ios-accessibility
ios-app-workflow
references
ios-ettrace-performance
ios-localization
ios-memgraph-analysis
ios-networking
ios-simulator
references
metrickit
references
musickit
references
natural-language
paperkit
references
passkit
references
pdfkit
pencilkit
references
permissionkit
references
photokit
push-notifications
quicklook
references
realitykit
references
relevancekit
references
scenekit
sensorkit
shazamkit
references
speech-recognition
references
spritekit
storekit
swift-api-design-guidelines
swift-architecture
references
swift-charts
swift-codable
references
swift-code-review
swift-concurrency
swift-formatstyle
references
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-responsive-layout
swiftui-uikit-interop
swiftui-webkit
tabletopkit
tipkit
vision-framework
weatherkit
references