# iOS Sample: OctetSample

A SwiftUI demo of the public SDK surface, built around **two tabs**: **Generate** (produce a proof) and **Verify** (check one on-device with `Octet.verify`). It lives under [`octet-sdk/samples-public/ios-sample`](https://github.com/octetproof/octet-sdk/tree/main/samples-public/ios-sample).

## What it does

**Generate.** Pick a region, then watch the proof pipeline run step by step (SDK initialized -> sensors warmed up -> location fixed -> proof generated), with per-step timings and a map of your position. You get back the predicate answer from `sdk.loc.isWithin(...)`, and a result card showing the outcome, a confidence bucket, and the battery the run consumed. Generated proofs are kept in a sample-owned store.

**Verify.** Run `Octet.verify(...)` on any stored or imported proof and read the grouped [on-device checks](/docs/v2.0/concepts/on-device-verification/) (signature, freshness, hardware attestation, and the rest), each with a one-line note on any check that could not run and how to make it run. Pick a region to check the proof's claim against, and see the granularity the proof reveals (nothing finer than its level). Proofs export and import as `.octetproof` files over AirDrop, Files, or the share sheet.

## Setup

The SDK activates by **attesting the app instance**. There is no license key to paste. On a real device it uses Apple App Attest and bootstraps its license on first launch. Copy the local config so the sample builds:

```bash
cd samples-public/ios-sample
cp LocalConfig.swift.example LocalConfig.swift
```

`LocalConfig.swift` is gitignored. Skip it and the build fails with `cannot find 'LocalConfig' in scope`.

Register the sample's bundle id (`com.octetproof.sample`, or your own) under your Octet account, as described in [Prerequisites](/docs/v2.0/getting-started/prerequisites/), so its attestation resolves to a registered app.

## Build

`project.yml` is the source; the `.xcodeproj` is generated. Install [XcodeGen](https://github.com/yonaskolb/XcodeGen) once (`brew install xcodegen`), then:

```bash
xcodegen generate
open OctetSample.xcodeproj
```

In Xcode: set your **Apple Development Team** under *Signing & Capabilities*, and provision an App ID carrying the **App Attest** capability for the bundle id. The required `Info.plist` keys (`NSLocationWhenInUseUsageDescription`, `NSMotionUsageDescription`) are already in place.

## Run on a real device

This sample needs a physical device. The simulator has no real motion, GNSS, or cellular hardware, and cannot attest the app instance, so it cannot generate proofs.

## Requirements

- iOS 17+ on the device (the sample's deployment target)
- Xcode with XcodeGen
- An App ID with the App Attest capability, registered under your Octet account

## See also

- [iOS Quick Start](/docs/v2.0/getting-started/ios-quickstart/). Integrating the SDK from scratch.
- [On-device Verification](/docs/v2.0/concepts/on-device-verification/). What the Verify tab runs.
- [Troubleshooting FAQ](/docs/v2.0/troubleshooting/faq/). What to do when verdicts don't look right.
