Hemoglobin A1C Quick Reference
Hemoglobin A1C Quick Reference
Testing status: A1C export has been verified working end-to-end on a physical device with Clinical Health Records enabled.
What It Does
- Exports Hemoglobin A1C values from Apple Health Clinical Records
- Uses LOINC
4548-4to identify the matching lab result records - Includes A1C rows in the same CSV as weight, steps, and glucose
Key Files
HealthSampleTypes.swiftforA1CSampleand FHIR parsingHealthKitManager.swiftfor authorization andfetchA1CData(dateRange:limit:completion:)SettingsManager.swiftfor theexportA1CpreferenceDataSelectionView.swiftfor the A1C toggle and export flowCSVGenerator.swiftfor CSV row generation
Required Setup
Keep these generated Info.plist build settings in the Xcode project:
INFOPLIST_KEY_NSHealthClinicalHealthRecordsShareUsageDescriptionINFOPLIST_KEY_NSHealthShareUsageDescriptionINFOPLIST_KEY_NSHealthUpdateUsageDescription
Also make sure the target has HealthKit and Clinical Health Records capabilities enabled.
Runtime Notes
- The app currently targets iOS 26+
- The A1C code path itself is guarded with
#available(iOS 15.0, *) - Simulator support is limited; validate on a physical device
- The simulator-only test data generator is separate from the production export path
Export Flow
- User enables Hemoglobin A1C in the export screen
- App requests HealthKit read access
- A1C clinical records are fetched and parsed
- The combined CSV is generated in memory
- The file picker saves the export
CSV Example
Date,Metric,Value,Unit,Source
2026-01-15 14:30:00,Hemoglobin A1C,7.50,%,Apple Health
Notes
- Default export state for A1C is off
- A1C rows are formatted to 2 decimal places
- Existing export metrics are unaffected