Introduction
The Open Wearables iOS SDK (OpenWearablesHealthSDK) is a native Swift SDK for secure background synchronization of health data from Apple HealthKit to the Open Wearables platform.
This is the core native implementation that powers health data sync on iOS. The Flutter SDK uses this SDK under the hood as a wrapper.
GitHub Repository
View source code, report issues, and contribute to the iOS SDK.
Features
- Background Sync - Health data syncs even when your app is in the background via HealthKit observer queries and
BGTaskScheduler - Streaming Sync - Memory-efficient streaming processing for large datasets
- Resumable Sessions - Sync sessions survive app restarts and device reboots
- Dual Authentication - Token-based auth with auto-refresh or API key authentication
- Secure Storage - Credentials stored in iOS Keychain with
kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly - Automatic Retry - Persistent outbox with retry logic for failed uploads
- Per-User Isolation - State isolation between different user sessions
- Network Monitoring - Connectivity-aware sync with automatic resume
- Wide Data Support - Steps, heart rate, workouts, sleep, and 40+ data types
Requirements
| Requirement | Details |
|---|---|
| iOS Version | iOS 15.0+ |
| Swift | Swift 5.0+ (Swift tools 5.9) |
| Xcode | Xcode 15+ |
| Apple Developer Account | Required for HealthKit entitlement |
| HealthKit Capability | Must be enabled in Xcode |
| Physical Device | HealthKit doesn’t work in iOS Simulator |
Installation
- Swift Package Manager
- CocoaPods
Add the package to your Or in Xcode: File → Add Package Dependencies → paste the repository URL.
Package.swift:iOS Configuration
Add the following to yourInfo.plist:
- Open your
.xcodeprojor.xcworkspacein Xcode - Select your target → Signing & Capabilities
- Click + Capability → Add HealthKit
- Check Background Delivery if you want updates while app is closed
Quick Start
Here’s the minimal code to get health sync working:AppDelegate Setup
For background URL session support, add to yourAppDelegate:
Documentation
Integration Guide
Complete guide to integrating the SDK including authentication flow, backend setup, and best practices.
Troubleshooting
Common issues and their solutions for native iOS.
Supported Health Data Types
The SDK supports 40+ health data types via theHealthDataType enum. Pass these as enum values to requestAuthorization(types:completion:):
Activity & Fitness
Activity & Fitness
| Enum Case | Description |
|---|---|
.steps | Step count |
.distanceWalkingRunning | Walking/running distance |
.distanceCycling | Cycling distance |
.flightsClimbed | Floors climbed |
.walkingSpeed | Average walking speed |
.walkingStepLength | Step length |
.walkingAsymmetryPercentage | Walking asymmetry percentage |
.walkingDoubleSupportPercentage | Walking double support percentage |
.sixMinuteWalkTestDistance | 6-minute walk test |
.activeEnergy | Active energy burned |
.basalEnergy | Basal (resting) energy burned |
Heart & Vitals
Heart & Vitals
| Enum Case | Description |
|---|---|
.heartRate | Heart rate measurements |
.restingHeartRate | Resting heart rate |
.heartRateVariabilitySDNN | HRV (SDNN) |
.vo2Max | VO2 max |
.oxygenSaturation | Blood oxygen |
.respiratoryRate | Breathing rate |
Body Measurements
Body Measurements
| Enum Case | Description |
|---|---|
.bodyMass | Weight |
.height | Height |
.bmi | Body Mass Index |
.bodyFatPercentage | Body fat % |
.leanBodyMass | Lean body mass |
.waistCircumference | Waist circumference (iOS 16+) |
.bodyTemperature | Body temperature |
Blood & Metabolic
Blood & Metabolic
| Enum Case | Description |
|---|---|
.bloodGlucose | Blood glucose level |
.insulinDelivery | Insulin delivery (iOS 16+) |
.bloodPressureSystolic | Systolic blood pressure |
.bloodPressureDiastolic | Diastolic blood pressure |
.bloodPressure | Blood pressure (correlation type) |
Sleep & Mindfulness
Sleep & Mindfulness
| Enum Case | Description |
|---|---|
.sleep | Sleep sessions and stages |
.mindfulSession | Meditation/mindfulness sessions |
Reproductive Health
Reproductive Health
| Enum Case | Description |
|---|---|
.menstrualFlow | Menstrual flow |
.cervicalMucusQuality | Cervical mucus quality |
.ovulationTestResult | Ovulation test result |
.sexualActivity | Sexual activity |
Nutrition
Nutrition
| Enum Case | Description |
|---|---|
.dietaryEnergyConsumed | Calories consumed |
.dietaryCarbohydrates | Carbs |
.dietaryProtein | Protein |
.dietaryFatTotal | Total fat |
.dietaryWater | Water intake |
Workouts
Workouts
| Enum Case | Description |
|---|---|
.workout | All workout types with metadata (distance, energy, heart rate, running metrics, elevation, weather, swimming) |
Aliases
Aliases
| Enum Case | Alias For |
|---|---|
.restingEnergy | .basalEnergy |
.bloodOxygen | .oxygenSaturation |
Next Steps
Integration Guide
Complete step-by-step integration guide.
API Reference
Full API documentation on GitHub.

