{"id":"30b7a874-f83e-44e8-ba3b-cc132b59df64","shortId":"sr7kQb","kind":"skill","title":"healthkit","tagline":"Read, write, and query Apple Health data using HealthKit. Covers HKHealthStore authorization, sample queries, statistics queries, statistics collection queries for charts, saving HKQuantitySample data, background delivery, workout sessions with HKWorkoutSession and HKLiveWorkoutB","description":"# HealthKit\n\nRead and write health and fitness data from the Apple Health store. Covers authorization, queries, writing samples, background delivery, and workout sessions. Targets Swift 6.3 / iOS 26+.\n\n## Contents\n\n- [Setup and Availability](#setup-and-availability)\n- [Authorization](#authorization)\n- [Reading Data: Sample Queries](#reading-data-sample-queries)\n- [Reading Data: Statistics Queries](#reading-data-statistics-queries)\n- [Reading Data: Statistics Collection Queries](#reading-data-statistics-collection-queries)\n- [Writing Data](#writing-data)\n- [Background Delivery](#background-delivery)\n- [Workout Sessions](#workout-sessions)\n- [Common Data Types](#common-data-types)\n- [HKUnit Reference](#hkunit-reference)\n- [Common Mistakes](#common-mistakes)\n- [Review Checklist](#review-checklist)\n- [References](#references)\n\n## Setup and Availability\n\n### Project Configuration\n\n1. Enable the HealthKit capability in Xcode (adds the entitlement)\n2. Add `NSHealthShareUsageDescription` (read) and `NSHealthUpdateUsageDescription` (write) to Info.plist\n3. For background delivery, enable the \"Background Delivery\" sub-capability\n\n### Availability Check\n\nAlways check availability before accessing HealthKit. iPad and some devices do not support it.\n\n```swift\nimport HealthKit\n\nlet healthStore = HKHealthStore()\n\nguard HKHealthStore.isHealthDataAvailable() else {\n    // HealthKit not available on this device (e.g., iPad)\n    return\n}\n```\n\nCreate a single `HKHealthStore` instance and reuse it throughout your app. It is thread-safe.\n\n## Authorization\n\nRequest only the types your app genuinely needs. App Review rejects apps that over-request.\n\n```swift\nfunc requestAuthorization() async throws {\n    let typesToShare: Set<HKSampleType> = [\n        HKQuantityType(.stepCount),\n        HKQuantityType(.activeEnergyBurned)\n    ]\n\n    let typesToRead: Set<HKObjectType> = [\n        HKQuantityType(.stepCount),\n        HKQuantityType(.heartRate),\n        HKQuantityType(.activeEnergyBurned),\n        HKCharacteristicType(.dateOfBirth)\n    ]\n\n    try await healthStore.requestAuthorization(\n        toShare: typesToShare,\n        read: typesToRead\n    )\n}\n```\n\n### Checking Authorization Status\n\nThe app can only determine if it has **not yet requested** authorization. If the user denied access, HealthKit returns empty results rather than an error -- this is a privacy design.\n\n```swift\nlet status = healthStore.authorizationStatus(\n    for: HKQuantityType(.stepCount)\n)\n\nswitch status {\ncase .notDetermined:\n    // Haven't requested yet -- safe to call requestAuthorization\n    break\ncase .sharingAuthorized:\n    // User granted write access\n    break\ncase .sharingDenied:\n    // User denied write access (read denial is indistinguishable from \"no data\")\n    break\n@unknown default:\n    break\n}\n```\n\n## Reading Data: Sample Queries\n\nUse `HKSampleQueryDescriptor` (async/await) for one-shot reads. Prefer descriptors over the older callback-based `HKSampleQuery`.\n\n```swift\nfunc fetchRecentHeartRates() async throws -> [HKQuantitySample] {\n    let heartRateType = HKQuantityType(.heartRate)\n\n    let descriptor = HKSampleQueryDescriptor(\n        predicates: [.quantitySample(type: heartRateType)],\n        sortDescriptors: [SortDescriptor(\\.endDate, order: .reverse)],\n        limit: 20\n    )\n\n    let results = try await descriptor.result(for: healthStore)\n    return results\n}\n\n// Extracting values from samples:\nfor sample in results {\n    let bpm = sample.quantity.doubleValue(\n        for: HKUnit.count().unitDivided(by: .minute())\n    )\n    print(\"\\(bpm) bpm at \\(sample.endDate)\")\n}\n```\n\n## Reading Data: Statistics Queries\n\nUse `HKStatisticsQueryDescriptor` for aggregated single-value stats (sum, average, min, max).\n\n```swift\nfunc fetchTodayStepCount() async throws -> Double? {\n    let calendar = Calendar.current\n    let startOfDay = calendar.startOfDay(for: Date())\n    let endOfDay = calendar.date(byAdding: .day, value: 1, to: startOfDay)!\n\n    let predicate = HKQuery.predicateForSamples(\n        withStart: startOfDay, end: endOfDay\n    )\n    let stepType = HKQuantityType(.stepCount)\n    let samplePredicate = HKSamplePredicate.quantitySample(\n        type: stepType, predicate: predicate\n    )\n\n    let query = HKStatisticsQueryDescriptor(\n        predicate: samplePredicate,\n        options: .cumulativeSum\n    )\n\n    let result = try await query.result(for: healthStore)\n    return result?.sumQuantity()?.doubleValue(for: .count())\n}\n```\n\n**Options by data type:**\n- Cumulative types (steps, calories): `.cumulativeSum`\n- Discrete types (heart rate, weight): `.discreteAverage`, `.discreteMin`, `.discreteMax`\n\n## Reading Data: Statistics Collection Queries\n\nUse `HKStatisticsCollectionQueryDescriptor` for time-series data grouped into intervals -- ideal for charts.\n\n```swift\nfunc fetchDailySteps(forLast days: Int) async throws -> [(date: Date, steps: Double)] {\n    let calendar = Calendar.current\n    let endDate = calendar.startOfDay(\n        for: calendar.date(byAdding: .day, value: 1, to: Date())!\n    )\n    let startDate = calendar.date(byAdding: .day, value: -days, to: endDate)!\n\n    let predicate = HKQuery.predicateForSamples(\n        withStart: startDate, end: endDate\n    )\n    let stepType = HKQuantityType(.stepCount)\n    let samplePredicate = HKSamplePredicate.quantitySample(\n        type: stepType, predicate: predicate\n    )\n\n    let query = HKStatisticsCollectionQueryDescriptor(\n        predicate: samplePredicate,\n        options: .cumulativeSum,\n        anchorDate: endDate,\n        intervalComponents: DateComponents(day: 1)\n    )\n\n    let collection = try await query.result(for: healthStore)\n    var dailySteps: [(date: Date, steps: Double)] = []\n\n    collection.statisticsCollection.enumerateStatistics(\n        from: startDate, to: endDate\n    ) { statistics, _ in\n        let steps = statistics.sumQuantity()?\n            .doubleValue(for: .count()) ?? 0\n        dailySteps.append((date: statistics.startDate, steps: steps))\n    }\n\n    return dailySteps\n}\n```\n\n### Long-Running Collection Query\n\nUse `results(for:)` (plural) to get an `AsyncSequence` that emits updates as new data arrives:\n\n```swift\nlet updateStream = query.results(for: healthStore)\n\nTask {\n    for try await result in updateStream {\n        // result.statisticsCollection contains updated data\n    }\n}\n```\n\n## Writing Data\n\nCreate `HKQuantitySample` objects and save them to the store.\n\n```swift\nfunc saveSteps(count: Double, start: Date, end: Date) async throws {\n    let stepType = HKQuantityType(.stepCount)\n    let quantity = HKQuantity(unit: .count(), doubleValue: count)\n\n    let sample = HKQuantitySample(\n        type: stepType,\n        quantity: quantity,\n        start: start,\n        end: end\n    )\n\n    try await healthStore.save(sample)\n}\n\n```\n\nYour app can only delete samples it created. Samples from other apps or Apple Watch are read-only.\n\n## Background Delivery\n\nRegister for background updates so your app is launched when new data arrives. Requires the background delivery entitlement.\n\n```swift\nfunc enableStepCountBackgroundDelivery() async throws {\n    let stepType = HKQuantityType(.stepCount)\n\n    try await healthStore.enableBackgroundDelivery(\n        for: stepType,\n        frequency: .hourly\n    )\n}\n```\n\n**Pair with an `HKObserverQuery`** to handle notifications. Always call the completion handler:\n\n```swift\nlet observerQuery = HKObserverQuery(\n    sampleType: HKQuantityType(.stepCount),\n    predicate: nil\n) { query, completionHandler, error in\n    defer { completionHandler() }  // Must call to signal done\n    guard error == nil else { return }\n    // Fetch new data, update UI, etc.\n}\nhealthStore.execute(observerQuery)\n```\n\n**Frequencies:** `.immediate`, `.hourly`, `.daily`, `.weekly`\n\nCall `enableBackgroundDelivery` once (e.g., at app launch). The system persists the registration.\n\n## Workout Sessions\n\nUse `HKWorkoutSession` and `HKLiveWorkoutBuilder` to track live workouts. Available on watchOS 2+ and iOS 17+.\n\n```swift\nfunc startWorkout() async throws {\n    let configuration = HKWorkoutConfiguration()\n    configuration.activityType = .running\n    configuration.locationType = .outdoor\n\n    let session = try HKWorkoutSession(\n        healthStore: healthStore,\n        configuration: configuration\n    )\n    session.delegate = self\n\n    let builder = session.associatedWorkoutBuilder()\n    builder.dataSource = HKLiveWorkoutDataSource(\n        healthStore: healthStore,\n        workoutConfiguration: configuration\n    )\n\n    session.startActivity(with: Date())\n    try await builder.beginCollection(at: Date())\n}\n\nfunc endWorkout(\n    session: HKWorkoutSession,\n    builder: HKLiveWorkoutBuilder\n) async throws {\n    session.end()\n    try await builder.endCollection(at: Date())\n    try await builder.finishWorkout()\n}\n```\n\nFor full workout lifecycle management including pause/resume, delegate handling, and multi-device mirroring, see [references/healthkit-patterns.md](references/healthkit-patterns.md).\n\n## Common Data Types\n\n### HKQuantityTypeIdentifier\n\n| Identifier | Category | Unit |\n|---|---|---|\n| `.stepCount` | Fitness | `.count()` |\n| `.distanceWalkingRunning` | Fitness | `.meter()` |\n| `.activeEnergyBurned` | Fitness | `.kilocalorie()` |\n| `.basalEnergyBurned` | Fitness | `.kilocalorie()` |\n| `.heartRate` | Vitals | `.count()/.minute()` |\n| `.restingHeartRate` | Vitals | `.count()/.minute()` |\n| `.oxygenSaturation` | Vitals | `.percent()` |\n| `.bodyMass` | Body | `.gramUnit(with: .kilo)` |\n| `.bodyMassIndex` | Body | `.count()` |\n| `.height` | Body | `.meter()` |\n| `.bodyFatPercentage` | Body | `.percent()` |\n| `.bloodGlucose` | Lab | `.gramUnit(with: .milli).unitDivided(by: .literUnit(with: .deci))` |\n\n### HKCategoryTypeIdentifier\n\nCommon category types: `.sleepAnalysis`, `.mindfulSession`, `.appleStandHour`\n\n### HKCharacteristicType\n\nRead-only user characteristics: `.dateOfBirth`, `.biologicalSex`, `.bloodType`, `.fitzpatrickSkinType`\n\n## HKUnit Reference\n\n```swift\n// Basic units\nHKUnit.count()                              // Steps, counts\nHKUnit.meter()                              // Distance\nHKUnit.mile()                               // Distance (imperial)\nHKUnit.kilocalorie()                        // Energy\nHKUnit.joule(with: .kilo)                   // Energy (SI)\nHKUnit.gramUnit(with: .kilo)                // Mass (kg)\nHKUnit.pound()                              // Mass (imperial)\nHKUnit.percent()                            // Percentage\n\n// Compound units\nHKUnit.count().unitDivided(by: .minute())   // Heart rate (bpm)\nHKUnit.meter().unitDivided(by: .second())   // Speed (m/s)\n\n// Prefixed units\nHKUnit.gramUnit(with: .milli)               // Milligrams\nHKUnit.literUnit(with: .deci)               // Deciliters\n```\n\n## Common Mistakes\n\n### 1. Over-requesting data types\n\nDON'T -- request everything:\n```swift\n// App Review will reject this\nlet allTypes: Set<HKObjectType> = [\n    HKQuantityType(.stepCount),\n    HKQuantityType(.heartRate),\n    HKQuantityType(.bloodGlucose),\n    HKQuantityType(.bodyMass),\n    HKQuantityType(.oxygenSaturation),\n    // ...20 more types the app never uses\n]\n```\n\nDO -- request only what you use:\n```swift\nlet neededTypes: Set<HKObjectType> = [\n    HKQuantityType(.stepCount),\n    HKQuantityType(.activeEnergyBurned)\n]\n```\n\n### 2. Not handling authorization denial\n\nDON'T -- assume data will be returned:\n```swift\nfunc getSteps() async throws -> Double {\n    let result = try await query.result(for: healthStore)\n    return result!.sumQuantity()!.doubleValue(for: .count()) // Crashes if denied\n}\n```\n\nDO -- handle nil gracefully:\n```swift\nfunc getSteps() async throws -> Double {\n    let result = try await query.result(for: healthStore)\n    return result?.sumQuantity()?.doubleValue(for: .count()) ?? 0\n}\n```\n\n### 3. Assuming HealthKit is always available\n\nDON'T -- skip the check:\n```swift\nlet store = HKHealthStore() // Crashes on iPad\ntry await store.requestAuthorization(toShare: types, read: types)\n```\n\nDO -- guard availability:\n```swift\nguard HKHealthStore.isHealthDataAvailable() else {\n    showUnsupportedDeviceMessage()\n    return\n}\n```\n\n### 4. Running heavy queries on the main thread\n\nDON'T -- use old callback-based queries on main thread. DO -- use async descriptors:\n```swift\n// Bad: HKSampleQuery with callback on main thread\n// Good: async descriptor\nfunc loadAllData() async throws -> [HKQuantitySample] {\n    let descriptor = HKSampleQueryDescriptor(\n        predicates: [.quantitySample(type: stepType)],\n        sortDescriptors: [SortDescriptor(\\.endDate, order: .reverse)],\n        limit: 100\n    )\n    return try await descriptor.result(for: healthStore)\n}\n```\n\n### 5. Forgetting to call completionHandler in observer queries\n\nDON'T -- skip the completion handler:\n```swift\nlet query = HKObserverQuery(sampleType: type, predicate: nil) { _, handler, _ in\n    processNewData()\n    // Forgot to call handler() -- system won't schedule next delivery\n}\n```\n\nDO -- always call it:\n```swift\nlet query = HKObserverQuery(sampleType: type, predicate: nil) { _, handler, _ in\n    defer { handler() }\n    processNewData()\n}\n```\n\n### 6. Using wrong statistics options for the data type\n\nDON'T -- use cumulative sum on discrete types:\n```swift\n// Heart rate is discrete, not cumulative -- this returns nil\nlet query = HKStatisticsQueryDescriptor(\n    predicate: heartRatePredicate,\n    options: .cumulativeSum\n)\n```\n\nDO -- match options to data type:\n```swift\n// Use discrete options for discrete types\nlet query = HKStatisticsQueryDescriptor(\n    predicate: heartRatePredicate,\n    options: .discreteAverage\n)\n```\n\n## Review Checklist\n\n- [ ] `HKHealthStore.isHealthDataAvailable()` checked before any HealthKit access\n- [ ] Only necessary data types requested in authorization\n- [ ] `Info.plist` includes `NSHealthShareUsageDescription` and/or `NSHealthUpdateUsageDescription`\n- [ ] HealthKit capability enabled in Xcode project\n- [ ] Authorization denial handled gracefully (nil results, not crashes)\n- [ ] Single `HKHealthStore` instance reused (not created per query)\n- [ ] Async query descriptors used instead of callback-based queries\n- [ ] Heavy queries not blocking main thread\n- [ ] Statistics options match data type (cumulative vs. discrete)\n- [ ] Background delivery paired with `HKObserverQuery` and `completionHandler` called\n- [ ] Background delivery entitlement enabled if using `enableBackgroundDelivery`\n- [ ] Workout sessions properly ended and builder finalized\n- [ ] Write operations only for sample types the app created\n\n## References\n\n- Extended patterns (workouts, anchored queries, SwiftUI integration): [references/healthkit-patterns.md](references/healthkit-patterns.md)\n- [HealthKit framework](https://sosumi.ai/documentation/healthkit)\n- [HKHealthStore](https://sosumi.ai/documentation/healthkit/hkhealthstore)\n- [HKSampleQueryDescriptor](https://sosumi.ai/documentation/healthkit/hksamplequerydescriptor)\n- [HKStatisticsQueryDescriptor](https://sosumi.ai/documentation/healthkit/hkstatisticsquerydescriptor)\n- [HKStatisticsCollectionQueryDescriptor](https://sosumi.ai/documentation/healthkit/hkstatisticscollectionquerydescriptor)\n- [HKWorkoutSession](https://sosumi.ai/documentation/healthkit/hkworkoutsession)\n- [HKLiveWorkoutBuilder](https://sosumi.ai/documentation/healthkit/hkliveworkoutbuilder)\n- [Setting up HealthKit](https://sosumi.ai/documentation/healthkit/setting-up-healthkit)\n- [Authorizing access to health data](https://sosumi.ai/documentation/healthkit/authorizing-access-to-health-data)","tags":["healthkit","swift","ios","skills","dpearson2699","accessibility","agent-skills","ai-coding","apple","claude-code","codex-skills","cursor-skills"],"capabilities":["skill","source-dpearson2699","skill-healthkit","topic-accessibility","topic-agent-skills","topic-ai-coding","topic-apple","topic-claude-code","topic-codex-skills","topic-cursor-skills","topic-ios","topic-ios-development","topic-liquid-glass","topic-localization","topic-mapkit"],"categories":["swift-ios-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/dpearson2699/swift-ios-skills/healthkit","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add dpearson2699/swift-ios-skills","source_repo":"https://github.com/dpearson2699/swift-ios-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 599 github stars · SKILL.md body (15,511 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:53:41.867Z","embedding":null,"createdAt":"2026-04-18T20:34:15.139Z","updatedAt":"2026-05-18T18:53:41.867Z","lastSeenAt":"2026-05-18T18:53:41.867Z","tsv":"'/.minute':950,954 '/documentation/healthkit)':1474 '/documentation/healthkit/authorizing-access-to-health-data)':1512 '/documentation/healthkit/hkhealthstore)':1478 '/documentation/healthkit/hkliveworkoutbuilder)':1498 '/documentation/healthkit/hksamplequerydescriptor)':1482 '/documentation/healthkit/hkstatisticscollectionquerydescriptor)':1490 '/documentation/healthkit/hkstatisticsquerydescriptor)':1486 '/documentation/healthkit/hkworkoutsession)':1494 '/documentation/healthkit/setting-up-healthkit)':1504 '0':628,1163 '1':145,460,559,601,1056 '100':1250 '17':854 '2':155,851,1106 '20':393,1085 '26':61 '3':164,1164 '4':1198 '5':1257 '6':1309 '6.3':59 'access':181,291,330,337,1370,1506 'activeenergyburn':253,262,941,1105 'add':152,156 'aggreg':431 'alltyp':1073 'alway':177,783,1168,1293 'anchor':1464 'anchord':596 'and/or':1381 'app':219,231,234,237,276,722,732,748,831,1067,1089,1458 'appl':6,44,734 'applestandhour':988 'arriv':655,754 'assum':1113,1165 'async':245,373,443,542,693,763,858,900,1121,1147,1219,1230,1234,1405 'async/await':355 'asyncsequ':648 'author':13,48,70,71,225,273,286,1109,1377,1389,1505 'avail':65,69,142,175,179,202,848,1169,1191 'averag':437 'await':266,397,491,605,665,718,770,890,904,909,1127,1153,1183,1253 'background':26,52,106,109,166,170,740,744,757,1429,1437 'background-deliveri':108 'bad':1222 'basalenergyburn':944 'base':368,1212,1413 'basic':1002 'biologicalsex':996 'block':1418 'bloodglucos':972,1080 'bloodtyp':997 'bodi':959,964,967,970 'bodyfatpercentag':969 'bodymass':958,1082 'bodymassindex':963 'bpm':412,420,421,1037 'break':324,331,345,348 'builder':878,898,1449 'builder.begincollection':891 'builder.datasource':880 'builder.endcollection':905 'builder.finishworkout':910 'byad':457,556,565 'calendar':447,549 'calendar.current':448,550 'calendar.date':456,555,564 'calendar.startofday':451,553 'call':322,784,804,826,1260,1284,1294,1436 'callback':367,1211,1225,1412 'callback-bas':366,1210,1411 'calori':508 'capabl':149,174,1384 'case':314,325,332 'categori':933,984 'characterist':994 'chart':22,535 'check':176,178,272,1174,1366 'checklist':134,137,1364 'collect':19,93,99,521,603,639 'collection.statisticscollection.enumeratestatistics':615 'common':116,120,128,131,928,983,1054 'common-data-typ':119 'common-mistak':130 'complet':786,1269 'completionhandl':798,802,1261,1435 'compound':1029 'configur':144,861,873,874,885 'configuration.activitytype':863 'configuration.locationtype':865 'contain':670 'content':62 'count':500,627,687,703,705,937,949,953,965,1006,1136,1162 'cover':11,47 'crash':1137,1179,1396 'creat':209,675,728,1402,1459 'cumul':505,1321,1332,1426 'cumulativesum':487,509,595,1342 'daili':824 'dailystep':610,635 'dailysteps.append':629 'data':8,25,41,73,78,82,87,91,97,102,105,117,121,344,350,425,503,519,529,654,672,674,753,815,929,1060,1114,1316,1347,1373,1424,1509 'date':453,544,545,561,611,612,630,690,692,888,893,907 'datecompon':599 'dateofbirth':264,995 'day':458,540,557,566,568,600 'deci':981,1052 'decilit':1053 'default':347 'defer':801,1306 'deleg':918 'delet':725 'deliveri':27,53,107,110,167,171,741,758,1291,1430,1438 'deni':290,335,1139 'denial':339,1110,1390 'descriptor':362,381,1220,1231,1238,1407 'descriptor.result':398,1254 'design':304 'determin':279 'devic':186,205,923 'discret':510,1324,1330,1351,1354,1428 'discreteaverag':515,1362 'discretemax':517 'discretemin':516 'distanc':1008,1010 'distancewalkingrun':938 'done':807 'doubl':445,547,614,688,1123,1149 'doublevalu':498,625,704,1134,1160 'e.g':206,829 'els':199,811,1195 'emit':650 'empti':294 'enabl':146,168,1385,1440 'enablebackgrounddeliveri':827,1443 'enablestepcountbackgrounddeliveri':762 'end':468,576,691,715,716,1447 'enddat':389,552,570,577,597,619,1246 'endofday':455,469 'endworkout':895 'energi':1013,1017 'entitl':154,759,1439 'error':299,799,809 'etc':818 'everyth':1065 'extend':1461 'extract':403 'fetch':813 'fetchdailystep':538 'fetchrecentheartr':372 'fetchtodaystepcount':442 'final':1450 'fit':40,936,939,942,945 'fitzpatrickskintyp':998 'forget':1258 'forgot':1282 'forlast':539 'framework':1471 'frequenc':774,821 'full':912 'func':243,371,441,537,685,761,856,894,1119,1145,1232 'genuin':232 'get':646 'getstep':1120,1146 'good':1229 'grace':1143,1392 'gramunit':960,974 'grant':328 'group':530 'guard':197,808,1190,1193 'handl':781,919,1108,1141,1391 'handler':787,1270,1279,1285,1304,1307 'haven':316 'health':7,38,45,1508 'healthkit':1,10,34,148,182,193,200,292,1166,1369,1383,1470,1501 'healthstor':195,400,494,608,661,871,872,882,883,1130,1156,1256 'healthstore.authorizationstatus':308 'healthstore.enablebackgrounddelivery':771 'healthstore.execute':819 'healthstore.requestauthorization':267 'healthstore.save':719 'heart':512,1035,1327 'heartrat':260,379,947,1078 'heartratepred':1340,1360 'heartratetyp':377,386 'heavi':1200,1415 'height':966 'hkcategorytypeidentifi':982 'hkcharacteristictyp':263,989 'hkhealthstor':12,196,212,1178,1398,1475 'hkhealthstore.ishealthdataavailable':198,1194,1365 'hkliveworkoutb':33 'hkliveworkoutbuild':843,899,1495 'hkliveworkoutdatasourc':881 'hkobserverqueri':779,791,1274,1299,1433 'hkquantiti':701 'hkquantitysampl':24,375,676,708,1236 'hkquantitytyp':250,252,257,259,261,310,378,472,580,697,767,793,1075,1077,1079,1081,1083,1102,1104 'hkquantitytypeidentifi':931 'hkquery.predicateforsamples':465,573 'hksamplepredicate.quantitysample':476,584 'hksamplequeri':369,1223 'hksamplequerydescriptor':354,382,1239,1479 'hkstatisticscollectionquerydescriptor':524,591,1487 'hkstatisticsquerydescriptor':429,483,1338,1358,1483 'hkunit':123,126,999 'hkunit-refer':125 'hkunit.count':415,1004,1031 'hkunit.gramunit':1019,1046 'hkunit.joule':1014 'hkunit.kilocalorie':1012 'hkunit.literunit':1050 'hkunit.meter':1007,1038 'hkunit.mile':1009 'hkunit.percent':1027 'hkunit.pound':1024 'hkworkoutconfigur':862 'hkworkoutsess':31,841,870,897,1491 'hour':775,823 'ideal':533 'identifi':932 'immedi':822 'imperi':1011,1026 'import':192 'includ':916,1379 'indistinguish':341 'info.plist':163,1378 'instanc':213,1399 'instead':1409 'int':541 'integr':1467 'interv':532 'intervalcompon':598 'io':60,853 'ipad':183,207,1181 'kg':1023 'kilo':962,1016,1021 'kilocalori':943,946 'lab':973 'launch':750,832 'let':194,247,254,306,376,380,394,411,446,449,454,463,470,474,481,488,548,551,562,571,578,582,589,602,622,657,695,699,706,765,789,860,867,877,1072,1099,1124,1150,1176,1237,1272,1297,1336,1356 'lifecycl':914 'limit':392,1249 'literunit':979 'live':846 'loadalldata':1233 'long':637 'long-run':636 'm/s':1043 'main':1204,1215,1227,1419 'manag':915 'mass':1022,1025 'match':1344,1423 'max':439 'meter':940,968 'milli':976,1048 'milligram':1049 'min':438 'mindfulsess':987 'minut':418,1034 'mirror':924 'mistak':129,132,1055 'multi':922 'multi-devic':921 'must':803 'necessari':1372 'need':233 'neededtyp':1100 'never':1090 'new':653,752,814 'next':1290 'nil':796,810,1142,1278,1303,1335,1393 'notdetermin':315 'notif':782 'nshealthshareusagedescript':157,1380 'nshealthupdateusagedescript':160,1382 'object':677 'observ':1263 'observerqueri':790,820 'old':1209 'older':365 'one':358 'one-shot':357 'oper':1452 'option':486,501,594,1313,1341,1345,1352,1361,1422 'order':390,1247 'outdoor':866 'over-request':239,1057 'oxygensatur':955,1084 'pair':776,1431 'pattern':1462 'pause/resume':917 'per':1403 'percent':957,971 'percentag':1028 'persist':835 'plural':644 'predic':383,464,479,480,484,572,587,588,592,795,1240,1277,1302,1339,1359 'prefer':361 'prefix':1044 'print':419 'privaci':303 'processnewdata':1281,1308 'project':143,1388 'proper':1446 'quantiti':700,711,712 'quantitysampl':384,1241 'queri':5,15,17,20,49,75,80,84,89,94,100,352,427,482,522,590,640,797,1201,1213,1264,1273,1298,1337,1357,1404,1406,1414,1416,1465 'query.result':492,606,1128,1154 'query.results':659 'rate':513,1036,1328 'rather':296 'read':2,35,72,77,81,86,90,96,158,270,338,349,360,424,518,738,991,1187 'read-on':737,990 'reading-data-sample-queri':76 'reading-data-statistics-collection-queri':95 'reading-data-statistics-queri':85 'refer':124,127,138,139,1000,1460 'references/healthkit-patterns.md':926,927,1468,1469 'regist':742 'registr':837 'reject':236,1070 'request':226,241,285,318,1059,1064,1093,1375 'requestauthor':244,323 'requir':755 'restingheartr':951 'result':295,395,402,410,489,496,642,666,1125,1132,1151,1158,1394 'result.statisticscollection':669 'return':208,293,401,495,634,812,1117,1131,1157,1197,1251,1334 'reus':215,1400 'revers':391,1248 'review':133,136,235,1068,1363 'review-checklist':135 'run':638,864,1199 'safe':224,320 'sampl':14,51,74,79,351,406,408,707,720,726,729,1455 'sample.enddate':423 'sample.quantity.doublevalue':413 'samplepred':475,485,583,593 'sampletyp':792,1275,1300 'save':23,679 'savestep':686 'schedul':1289 'second':1041 'see':925 'self':876 'seri':528 'session':29,56,112,115,839,868,896,1445 'session.associatedworkoutbuilder':879 'session.delegate':875 'session.end':902 'session.startactivity':886 'set':249,256,1074,1101,1499 'setup':63,67,140 'setup-and-avail':66 'sharingauthor':326 'sharingdeni':333 'shot':359 'showunsupporteddevicemessag':1196 'si':1018 'signal':806 'singl':211,433,1397 'single-valu':432 'skill' 'skill-healthkit' 'skip':1172,1267 'sleepanalysi':986 'sortdescriptor':387,388,1244,1245 'sosumi.ai':1473,1477,1481,1485,1489,1493,1497,1503,1511 'sosumi.ai/documentation/healthkit)':1472 'sosumi.ai/documentation/healthkit/authorizing-access-to-health-data)':1510 'sosumi.ai/documentation/healthkit/hkhealthstore)':1476 'sosumi.ai/documentation/healthkit/hkliveworkoutbuilder)':1496 'sosumi.ai/documentation/healthkit/hksamplequerydescriptor)':1480 'sosumi.ai/documentation/healthkit/hkstatisticscollectionquerydescriptor)':1488 'sosumi.ai/documentation/healthkit/hkstatisticsquerydescriptor)':1484 'sosumi.ai/documentation/healthkit/hkworkoutsession)':1492 'sosumi.ai/documentation/healthkit/setting-up-healthkit)':1502 'source-dpearson2699' 'speed':1042 'start':689,713,714 'startdat':563,575,617 'startofday':450,462,467 'startworkout':857 'stat':435 'statist':16,18,83,88,92,98,426,520,620,1312,1421 'statistics.startdate':631 'statistics.sumquantity':624 'status':274,307,313 'step':507,546,613,623,632,633,1005 'stepcount':251,258,311,473,581,698,768,794,935,1076,1103 'steptyp':471,478,579,586,696,710,766,773,1243 'store':46,683,1177 'store.requestauthorization':1184 'sub':173 'sub-cap':172 'sum':436,1322 'sumquant':497,1133,1159 'support':189 'swift':58,191,242,305,370,440,536,656,684,760,788,855,1001,1066,1098,1118,1144,1175,1192,1221,1271,1296,1326,1349 'swiftui':1466 'switch':312 'system':834,1286 'target':57 'task':662 'thread':223,1205,1216,1228,1420 'thread-saf':222 'throughout':217 'throw':246,374,444,543,694,764,859,901,1122,1148,1235 'time':527 'time-seri':526 'topic-accessibility' 'topic-agent-skills' 'topic-ai-coding' 'topic-apple' 'topic-claude-code' 'topic-codex-skills' 'topic-cursor-skills' 'topic-ios' 'topic-ios-development' 'topic-liquid-glass' 'topic-localization' 'topic-mapkit' 'toshar':268,1185 'track':845 'tri':265,396,490,604,664,717,769,869,889,903,908,1126,1152,1182,1252 'type':118,122,229,385,477,504,506,511,585,709,930,985,1061,1087,1186,1188,1242,1276,1301,1317,1325,1348,1355,1374,1425,1456 'typestoread':255,271 'typestoshar':248,269 'ui':817 'unit':702,934,1003,1030,1045 'unitdivid':416,977,1032,1039 'unknown':346 'updat':651,671,745,816 'updatestream':658,668 'use':9,353,428,523,641,840,1091,1097,1208,1218,1310,1320,1350,1408,1442 'user':289,327,334,993 'valu':404,434,459,558,567 'var':609 'vital':948,952,956 'vs':1427 'watch':735 'watcho':850 'week':825 'weight':514 'withstart':466,574 'won':1287 'workout':28,55,111,114,838,847,913,1444,1463 'workout-sess':113 'workoutconfigur':884 'write':3,37,50,101,104,161,329,336,673,1451 'writing-data':103 'wrong':1311 'xcode':151,1387 'yet':284,319","prices":[{"id":"c35652fe-d349-4073-9c6f-d56f9938eb03","listingId":"30b7a874-f83e-44e8-ba3b-cc132b59df64","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"dpearson2699","category":"swift-ios-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:34:15.139Z"}],"sources":[{"listingId":"30b7a874-f83e-44e8-ba3b-cc132b59df64","source":"github","sourceId":"dpearson2699/swift-ios-skills/healthkit","sourceUrl":"https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/healthkit","isPrimary":false,"firstSeenAt":"2026-04-18T22:01:00.994Z","lastSeenAt":"2026-05-18T18:53:41.867Z"},{"listingId":"30b7a874-f83e-44e8-ba3b-cc132b59df64","source":"skills_sh","sourceId":"dpearson2699/swift-ios-skills/healthkit","sourceUrl":"https://skills.sh/dpearson2699/swift-ios-skills/healthkit","isPrimary":true,"firstSeenAt":"2026-04-18T20:34:15.139Z","lastSeenAt":"2026-05-07T22:40:33.410Z"}],"details":{"listingId":"30b7a874-f83e-44e8-ba3b-cc132b59df64","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"dpearson2699","slug":"healthkit","github":{"repo":"dpearson2699/swift-ios-skills","stars":599,"topics":["accessibility","agent-skills","ai-coding","apple","claude-code","codex-skills","cursor-skills","ios","ios-development","liquid-glass","localization","mapkit","networking","storekit","swift","swift-concurrency","swiftdata","swiftui","widgetkit","xcode"],"license":"other","html_url":"https://github.com/dpearson2699/swift-ios-skills","pushed_at":"2026-04-26T21:04:17Z","description":"Agent Skills for iOS 26+, Swift 6.3, SwiftUI, and modern Apple frameworks","skill_md_sha":"b59f8fd999faa608c8165f72986b6844e26418c6","skill_md_path":"skills/healthkit/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/healthkit"},"layout":"multi","source":"github","category":"swift-ios-skills","frontmatter":{"name":"healthkit","description":"Read, write, and query Apple Health data using HealthKit. Covers HKHealthStore authorization, sample queries, statistics queries, statistics collection queries for charts, saving HKQuantitySample data, background delivery, workout sessions with HKWorkoutSession and HKLiveWorkoutBuilder, HKUnit, and HKQuantityTypeIdentifier values. Use when integrating with Apple Health, displaying health metrics, recording workouts, or enabling background health data delivery."},"skills_sh_url":"https://skills.sh/dpearson2699/swift-ios-skills/healthkit"},"updatedAt":"2026-05-18T18:53:41.867Z"}}