Overview
The Synheart Core iOS/Swift SDK provides a unified API for collecting HSI-compatible data, processing human state on-device, and generating focus/emotion signals in native iOS applications. Key Features:- Native iOS support
- On-device HSI Runtime
- Combine framework integration
- Real-time state updates
- Privacy-first architecture
Installation
Swift Package Manager
Add to yourPackage.swift:
Xcode
- File > Add Packages…
- Enter repository URL:
https://github.com/synheart-ai/synheart-core-swift.git - Select version:
0.0.4or later (match the dependency entry above) - Add to your target
Configuration
Info.plist
Add required usage descriptions:Capabilities
Enable required capabilities in Xcode:- Select your target
- Go to “Signing & Capabilities”
- Add “HealthKit” (if using Wear module)
Basic Usage
Initialize the SDK
Subscribe to HSI Updates
Activate features
TheSynheartFeature enum gates collection by feature. Activation is
one of four conditions a feature needs (consent, capability tier, an
active session — see Capability System).
Synheart.onHSIUpdate. Parse the JSON to read them.
Complete example
SwiftUI view
HSI snapshot reference
The Synheart Runtime emits raw JSON strings viaonHSIUpdate
(AnyPublisher<String, Never>). Parse the JSON to extract fields like
the affect / engagement / activity / context axes. See the
HSI specification for the wire format.
Cloud Connector
Configuration Options
synheart-auth
integration — CloudConfig does not carry shared secrets or
HMAC keys. See Synheart Auth overview for
the device-identity flow.
Diagnostics & upload inspection
Use the diagnostics surface to inspect runtime state and force a flush when consent and network are eligible.Error handling
Privacy & consent
Async/await
API reference
Synheart
Main SDK class.
Static methods:
| Method | Description | Returns |
|---|---|---|
initialize(...) | Initialize the SDK | Void (async throws) |
activate(_:) | Activate a SynheartFeature | Void |
deactivate(_:) | Deactivate a SynheartFeature | Void |
dispose() | Tear down the SDK and release resources | Void |
| Publisher | Type | Description |
|---|---|---|
onHSIUpdate | AnyPublisher<String, Never> | Raw HSI 1.3 JSON, emitted per window close |
Resources
- Repository: synheart-core-swift
- Documentation: API Reference
- Issues: GitHub Issues
Related Documentation
- HSV Specification - Understand Synheart Core’s internal state model
- Architecture - Deep dive into the system
- Capability System - Access levels and permissions