iOS SDK Overview
vitallens-ios is the official Swift SDK for the VitalLens API, a service for estimating physiological vital signs from facial video.
The library provides:
- High-Fidelity Accuracy: A simple interface to the VitalLens API for state-of-the-art estimation (heart rate, respiratory rate, HRV).
- Drop-in UI Components: Ready-made SwiftUI views (
VitalLensScanView,VitalLensMonitorView) for instant integration into your app. - Flexible Input: Support for live iOS camera streams and local video file processing.
- Fast Face Detection: Native face detection and ROI management using Apple's Vision framework.
- Pluggable Architecture: Built on a strategy pattern, allowing you to swap the remote API backend for your own local CoreML models.
Using a different language? Check out our Python client or JavaScript client.
Installation
Add the package via Swift Package Manager in Xcode or your Package.swift:
Select the targets you need:
VitalLens: Main client logic.VitalLensUI: Pre-built SwiftUI views (Recommended).VitalLensInference: Pure logic and math (No camera or UI dependencies).
Quickstart
Note: The iOS SDK requires a valid API key to process video. You can get a free key from the API Dashboard.
The fastest way to get started is using the pre-built 30-second Scan component in SwiftUI:
import SwiftUI
import VitalLens
import VitalLensUI
struct ContentView: View {
var body: some View {
// Automatically selects the best model for your plan
VitalLensScanView(
apiKey: "YOUR_API_KEY",
method: "vitallens"
) { result in
// Handle the final result array
if let hr = result.heartRate?.value {
print("Final Heart Rate: \(hr) bpm")
}
}
}
}
Note: Remember to add NSCameraUsageDescription to your app's Info.plist.
Next Steps
Now that you have the client installed, explore the detailed guides:
SwiftUI Views โ Guide to using the pre-made views.
Usage Examples โ Examples and Usage Recipes.
Security & Proxies โ Deploying securely with a backend proxy.
- Advanced Use & Customization โ Deep integration into existing architectures.
API Reference โ Full specification of methods and parameters.
Requirements
- iOS 16.0+
- macOS 13.0+ (Core inference logic only)
- Camera Permission: Add
NSCameraUsageDescriptionto yourInfo.plist.
Disclaimer
vitallens-ios provides vital sign estimates for general wellness purposes only. It is not intended for medical use. Always consult with your doctor for any health concerns or for medically precise measurement.
See also our Terms of Service for the VitalLens API and our Privacy Policy.
License
This project is licensed under the MIT License.