iOS quickstart

  1. 1

    Add the package

    swift
    dependencies: [
        .package(url: "https://github.com/neetixai/liveliness-sdks.git", from: "0.2.0")
    ]

    Or in Xcode: File ▸ Add Package Dependencies with the same URL.

  2. 2

    Get a test key

    bash
    curl -X POST https://liveliness.neetix.in/v1/signup \
      -H 'Content-Type: application/json' \
      -d '{"email":"you@company.com"}'
    Do not ship a key in the app binary

    Anything compiled into an iOS app can be extracted from it. Use a test key while building, and for production either mint short-lived keys from your own backend or use hosted verification links. App Attest (NeetixAttestation) is what proves the call came from your real app.

  3. 3

    Make the call

    swift
    import NeetixLiveliness
    
    let nx = NeetixClient(apiKey: "YOUR_KEY")
    
    let selfie = try Data(contentsOf: selfieURL)
    let card = try Data(contentsOf: idURL)
    
    let res = try await nx.faceMatch(
        person: .jpeg(selfie),
        card: .jpeg(card),
        clientRefId: "application-4821"
    )
    
    print(res.verdict)                    // "approved" | "review" | "declined"
    print(res.result.isSameFace)
    print(res.warnings.map(\.code))

    verdict is a String, not an enum — compare it as one. warnings is a list of ApiWarning with code, severity and description.

    No key yet? The client can mint one without auth:

    swift
    let s = try await NeetixClient().signup(email: "you@company.com")
    // s.apiKey is shown once — 1,000 free credits
  4. 4

    Use the guided capture view

    NeetixCaptureView is a full-screen SwiftUI capture flow: AVFoundation preview, an oval face guide or an ID-1 card guide, live brightness and motion-stability hints, auto-capture after 1.5 s of stable good frames with a countdown ring, a manual shutter fallback, and a retake/confirm step.

    Output is already normalised JPEG — longest side ≤ 1280 px, quality 0.8 — so it uploads as-is with no resizing step of your own.

    swift
    import SwiftUI
    import NeetixLiveliness
    
    struct SelfieKycScreen: View {
        let nx = NeetixClient(apiKey: "YOUR_KEY")
        @State private var verdict: String?
    
        var body: some View {
            NeetixCaptureView(mode: .selfie) { jpeg in
                Task {
                    let res = try await nx.liveness(person: .jpeg(jpeg))
                    verdict = res.status
                }
            }
        }
    }

    Use mode: .document for the ID side — it switches to the back camera and the card guide.

Why guided capture matters

The engine rejects frames that are blurry, too dark, mis-aligned or have the eyes closed. Without on-device guidance, the user finds out only after a network round-trip and then has to retry blind. NeetixCaptureView runs those checks against the live preview, so a bad frame is never submitted in the first place — fewer retries, and fewer genuine users who give up.

Next

  • Get started — verdicts, warnings and credits.
  • REST API — what the client is calling underneath.