Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
mandarnilange avatar

Integrate Health Forge Apple

  • 1 installs
  • 1 repo stars
  • Updated July 2, 2026
  • mandarnilange/health_forge

Integrates the health_forge_apple adapter to read 14 Apple HealthKit metric types on iOS into the unified health_forge data model.

About

Integrates the Apple HealthKit adapter for the health_forge Flutter client, reading 14 read-only metric types (steps, heart rate, sleep, workouts, body metrics) on iOS. A developer uses it to add HealthKit as a data source, including entitlement setup.

  • 14 read-only HealthKit metric types mapped to the unified model
  • Covers iOS entitlements; requires the health_forge client

Integrate Health Forge Apple by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #959 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mandarnilange/health_forge --skill integrate-health-forge-apple

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars1
Last updatedJuly 2, 2026
Repositorymandarnilange/health_forge

What it does

Integrates the health_forge_apple adapter to read 14 Apple HealthKit metric types on iOS into the unified health_forge data model.

Files

SKILL.mdMarkdownGitHub ↗

Integrate health_forge_apple

Read Apple HealthKit data on iOS. 14 read-only metric types, mapped to the unified health_forge_core model.

Prerequisite: This adapter plugs into the health_forge Flutter client. Follow `integrate-health-forge` for client + cache setup first.

Supported metrics (14)

FamilyMetrics
Activitysteps, caloriesBurned, distanceSample, activitySession (workouts)
CardiovascularheartRateSample, heartRateVariability, restingHeartRate
SleepsleepSession with SleepStageSegments (6 HealthKit stage types aggregated + deduplicated into one session per night)
Bodyweight, bodyFat, bloodPressure, bloodGlucose
RespiratorybloodOxygen, respiratoryRate

Integration steps

1. Add dependency

dependencies:
  health_forge: ^0.1.1
  health_forge_apple: ^0.1.1

2. iOS — entitlements

Create or edit ios/Runner/Runner.entitlements:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.healthkit</key>
    <true/>
    <key>com.apple.developer.healthkit.access</key>
    <array/>
</dict>
</plist>

3. iOS — Info.plist usage descriptions

Edit ios/Runner/Info.plist:

<key>NSHealthShareUsageDescription</key>
<string>This app reads your health data to show fitness and wellness metrics.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>This app writes health data to keep your records in sync.</string>

(NSHealthUpdateUsageDescription is required even though this adapter is read-only — Apple rejects apps that link HealthKit without it.)

4. iOS — enable HealthKit capability in Xcode

Open ios/Runner.xcworkspace → select the Runner target → Signing & Capabilities → click + Capability → add HealthKit. Commit the resulting project/entitlements changes.

5. Register the provider

Gate on platform to avoid crashes on Android/desktop/web:

import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:health_forge/health_forge.dart';
import 'package:health_forge_apple/health_forge_apple.dart';

final forge = HealthForgeClient();

if (!kIsWeb && Platform.isIOS) {
  forge.use(AppleHealthProvider());
}

6. Authorize

final result = await forge.auth.authorize(DataProvider.apple);
if (!result.isSuccess) {
  // User denied or prompt was skipped — tell the user to grant access
  // in Settings → Privacy & Security → Health → [Your App].
  return;
}

7. Fetch data

final records = await forge.registry
    .getProvider(DataProvider.apple)!
    .fetchRecords(
      metricType: MetricType.heartRate,
      timeRange: TimeRange(
        start: DateTime.now().subtract(const Duration(days: 1)),
        end: DateTime.now(),
      ),
    );

for (final record in records) {
  if (record is HeartRateSample) {
    print('${record.beatsPerMinute} bpm @ ${record.startTime}');
    print('Source: ${record.provenance?.sourceDevice?.model}');
  }
}

Or use the client's query API — see `integrate-health-forge` step 5.

Provenance

HealthKit records include rich source metadata — the adapter populates:

record.provider                         // DataProvider.apple
record.providerRecordId                 // HealthKit UUID
record.provenance?.dataOrigin           // DataOrigin.native_
record.provenance?.sourceDevice?.model  // e.g. "Apple Watch Series 9"
record.provenance?.sourceApp            // Bundle ID, e.g. "com.apple.health"

Use sourceApp to deduplicate across iPhone vs. Apple Watch when both log the same metric (e.g. steps). A common pattern is to group by (provider, sourceApp) before summing.

Gotchas

  • `hasPermissions` is unreliable on iOS — after a successful authorize(), track auth state locally rather than polling isAuthorized(). iOS intentionally doesn't reveal denied read permissions.
  • Write permissions — not supported yet. All Apple adapter metrics are read-only.
  • Sleep sessions — HealthKit returns 6 individual stage samples (awake, core, deep, REM, inBed, asleep) with time-interval-encoded durations. The adapter aggregates and deduplicates these into one SleepSession per night with SleepStageSegments. Your code sees one session, not six raw samples.
  • High-frequency metrics (steps, HR) — Apple Watch writes samples every ~5 minutes. With the default merge config, records from iPhone + Watch that fall within 5 minutes will be collapsed. If you want every sample, set ConflictStrategy.keepAll for those metrics in MergeConfig.perMetricStrategy.
  • Simulator — HealthKit works in the iOS Simulator but there's no seed data by default. Use "Simulator → Device → Trigger iCloud Sync" or write sample data manually via the Health app on the simulator.

Related skills

  • `integrate-health-forge` — client setup (required)
  • `integrate-health-forge-core` — data model reference
  • `integrate-health-forge-ghc` — Android counterpart
  • `integrate-health-forge-oura` — cross-platform Oura data
  • `integrate-health-forge-strava` — cross-platform Strava data

Related skills

Mobile Developmentintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.