Overview
The Synheart Core Swift SDK collects approved signals, processes human state on-device, and delivers HSI 1.3 state windows to native Apple applications. Key features:- iOS, macOS, watchOS, and tvOS support
- On-device HSI processing
- Typed and raw Combine publishers
- Modular signal collection
- Consent-aware local storage and cloud delivery
Requirements
- iOS 16+, macOS 13+, watchOS 8+, tvOS 15+
- Swift 5.9 (Xcode 15 or later)
- The native Synheart runtime linked into the app
Installation
Add the Swift package
In Xcode, choose File → Add Package Dependencies and enter:Install the native runtime
The Swift package provides the Apple integration layer. On-device HSI computation requires the native Synheart runtime. From your app’s project directory:0.46.0 and needs 0.45.0 or later
(C ABI 4.2). An older runtime is refused at initialization. SDK 0.5 needs
0.42.0 or later; SDK 0.4.x and earlier need 0.38.0. To link a runtime you built yourself, use
synheart runtime install --from /path/to/runtime-distribution --project /path/to/project-dir.
See Install the runtime for runtime variants and linking instructions.
Apple permissions
Add only the usage descriptions required by the features your app enables:Quick start
The normal lifecycle is:Production configuration
Use pseudonymous subject identifiers and the service origins issued for your environment. Do not embed API secrets or shared signing keys in the application.Features and consent
A feature operates only when it is activated, consented, allowed by capability policy, and an eligible session is active.HSI state updates
Use the typed publisher for application logic:currentHSIState provides the latest typed value and currentState provides the latest raw JSON. HSI is emitted in windows, not for every sensor sample, so applications should show a collecting state while waiting for the first valid window.
See the HSI specification for the wire format.
Cloud delivery and diagnostics
Cloud delivery requires cloud configuration, consent, feature activation, device registration, and network availability.Advanced capabilities
The Swift SDK also exposes the following runtime-backed features. Availability depends on the linked runtime and the application’s capability policy.
Pairing tokens, recovery keys, and exported baseline material are sensitive. Keep them out of logs and analytics and store them using platform-protected storage.
Error handling
initialize throws SynheartRuntimeError (kind: .incompatible) before the
runtime is created when its C ABI is not 4.2 or a later 4.x, it is older than
0.45.0, or it does not report its build info.
SynheartError.runtimeVersionTooOld is no longer thrown.
After any native call that failed, Synheart.lastNativeError explains it: a
SynheartNativeError with code, message, retryable, ownerKind,
recoveryKind, recoveryCall, reason, argument, hint, op, and
errorId. A call that succeeds clears it. CoreRuntimeBridge.lastCreateError says why the runtime
handle could not be created.
Troubleshooting
Upgrading
See the changelog for the full list.