# Swift Quick Start (https://smartspectra.presagetech.com/docs/swift)

> For the complete documentation index, see [llms.txt](https://smartspectra.presagetech.com/llms.txt). Any documentation page is available as markdown by appending `.md` to its URL.

# SmartSpectra Swift Quickstart

This repo contains two build guides that produce similar user end states:

- [Option 1: API Key](https://smartspectra.presagetech.com/docs/swift/option-1-api-key.md)
- [Option 2: OAuth](https://smartspectra.presagetech.com/docs/swift/option-2-oauth.md)

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.

## Scope

These quickstarts intentionally request only:

- `SmartSpectraConfig.breathingMetrics`
- `SmartSpectraConfig.cardioMetrics`
- `MetricType.expressions`

Please see the detailed documents for additional features.

To supply frames from your own camera or video decoder, use
[`useCustomInput()`](https://smartspectra.presagetech.com/docs/swift/headless-mode.md#use-your-own-camera-or-video-source).
The SDK also supports its default camera capture through `start()`.
The demo app's [Video Testing sample](https://github.com/Presage-Security/SmartSpectra/blob/main/swift/samples/demo-app/VideoInput/VideoTestingView.swift)
decodes a selected clip and submits frames through this public API.

## Important Implementation Rules

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`, and `AVFoundation`.
- Use `let sdk = SmartSpectraSDK.shared`.
- Buffer pulse, breathing, arterial pressure, chest, and abdomen samples locally before drawing charts.

## Logging

SDK log verbosity defaults to warnings and errors only. To change it, set
`logLevel` on the SDK config:

```swift
SmartSpectraSDK.shared.config.logLevel = .info
```

Levels are cumulative — `.debug`, `.info`, `.warning` (default), `.error`,
`.none`. `.debug` cannot restore debug-only statements compiled out of the
release engine binary.

## Choose Your Guide

Use [Option 1: API Key](https://smartspectra.presagetech.com/docs/swift/option-1-api-key.md) for the fastest manual setup.

Use [Option 2: OAuth](https://smartspectra.presagetech.com/docs/swift/option-2-oauth.md) if you need OAuth.

Either way, an AI assistant connected to the [SmartSpectra MCP Server](https://smartspectra.presagetech.com/docs/mcp-server.md) 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`.

## LLM Insights

See [LLM Insights](https://smartspectra.presagetech.com/docs/swift/llm-insights.md) for natural-language analysis of the measured vitals.