Swift Quick Start
Measure pulse and breathing from the iPhone camera with the SmartSpectra Swift SDK. Requires iOS 17 or later; install, authenticate, and run.
This repo contains two build guides that produce similar user end states:
The only difference in builds is that the API key build gets up and running very fast, but hard-codes your API key. The OAuth build is more suitable for production deployments because it avoids hard-coding your API key.
These quickstarts intentionally request only:
SmartSpectraConfig.breathingMetricsSmartSpectraConfig.cardioMetricsMetricType.expressions
Please see the detailed documents for additional features.
Start by creating a new iOS app project named Cool Vitals.
The Quick Start is intended so that the developer can replace Cool Vitals/ContentView.swift as a full file.
- Import
SwiftUI,SmartSpectra, andAVFoundation. - Use
let sdk = SmartSpectraSDK.shared. - Buffer pulse, breathing, arterial pressure, chest, and abdomen samples locally before drawing charts.
SDK log verbosity defaults to warnings and errors only. To change it, set
logLevel on the SDK config:
SmartSpectraSDK.shared.config.logLevel = .infoLevels are cumulative — .debug, .info, .warning (default), .error,
.none. .debug cannot restore debug-only statements compiled out of the
release engine binary.
Use Option 1: API Key for the fastest manual setup.
Use Option 2: OAuth if you need OAuth.
Either way, an AI assistant connected to the SmartSpectra MCP Server can do the account side for you — fetch your API key, or register your bundle ID and Apple team ID and download PresageService-Info.plist.
See LLM Insights for natural-language analysis of the measured vitals.