Skip to main content

Overview

The Synheart Wear Swift SDK provides native iOS support for streaming biometric data from Apple Watch via HealthKit, vendor cloud APIs (WHOOP, Garmin, Fitbit, Oura), direct BLE heart-rate sensors, and offline Apple Health export.xml backfill.

Installation

Swift Package Manager

Add to your Package.swift:
Or in Xcode:
  1. File → Add Packages…
  2. Enter: https://github.com/synheart-ai/synheart-wear-swift.git

Requirements

  • iOS 13.0+
  • Swift 5.9+
  • Xcode 15.0+

Quick Start

Configure HealthKit

Add to Info.plist:
Enable HealthKit capability in Xcode:
  • Target → Signing & Capabilities → + Capability → HealthKit

Initialize SDK

Request Permissions & Read Data

Real-Time Streaming

streamHR(interval:) returns a Combine AnyPublisher<WearMetrics, Error>. Use streamHRAsync(interval:) if you prefer AsyncStream.

BLE Heart Rate Monitor

Connect directly to any standard Bluetooth LE heart rate monitor for real-time HR streaming.

Setup

Add to Info.plist:

Usage

Supported Devices

Works with any BLE device implementing the standard Heart Rate Profile (0x180D):
  • WHOOP (Broadcast HR mode)
  • Polar H10, OH1
  • Wahoo TICKR
  • Garmin HRM-Pro / HRM-Dual

Cloud providers (WHOOP / Garmin / Fitbit / Oura)

Each cloud vendor is exposed via a typed accessor on SynheartWear plus the generic getProvider() lookup:
OAuth is mediated by the Synheart Wear API; the device never sees vendor access tokens. Call provider.connect() to launch the system browser at the authorize URL, then provider.connectWithCode(code:state:redirectUri:) from your deep-link handler. For Fitbit and Oura, the cloud delivers a vendor_user_id directly via deep link — pass that as the code argument.

Apple Health XML Backfill

The AppleXmlImport module ingests an Apple Health export.xml (the file produced by the Health app’s “Export All Health Data” feature) and converts it into a stream of AppleHealthSample records. The streaming SAX parser stays under a 200 MB working-set budget regardless of file size, so multi-hundred-MB exports are safe.
Each sample’s stable identity is computed by IdempotencyKey (SHA-256 over a canonical subset of fields), so re-running the import on the same file produces the same keys and downstream sinks can dedupe safely.

Garmin Health SDK (Native RTS)

The GarminHealth facade provides native Garmin device integration for scanning, pairing, and real-time streaming using generic SDK-owned types.
Important: The Garmin Health SDK Real-Time Streaming (RTS) capability requires a separate license from Garmin. This facade is available on demand for licensed integrations. The underlying Garmin Health SDK code is proprietary to Garmin and is not distributed as open source.
For cloud-based Garmin data (OAuth + webhooks), use GarminProvider instead.

Resources

For comprehensive documentation, see the full README on GitHub.