Amigo AIAmigo AI
Back to Docs

Getting Started with Amigo AI SDK

Amigo AI SDK lets you add real-time face swap to your iOS app. Drop-in SwiftUI camera view, per-frame API for WebRTC, and static image swap — all on-device at 512px resolution.

Prerequisites

  • An Amigo AI API key (sign up free)
  • iOS 16+ with Xcode 15+
  • Swift 5.9+

Installation (Swift Package Manager)

Add the package to your Xcode project:

https://github.com/AmigoAIAdmin/AmigoSDK_iOS.git

Or add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/AmigoAIAdmin/AmigoSDK_iOS.git", branch: "main")
]

Quick Start — Live Camera (SwiftUI)

import SwiftUI
import AmigoFaceSwapSDK

struct FaceSwapView: View {
    @State private var latent: FaceLatent?

    var body: some View {
        Group {
            if let latent {
                AmigoLiveCameraView(targetLatent: latent)
                    .ignoresSafeArea()
            } else {
                ProgressView("Loading…")
            }
        }
        .task {
            // Initialize once (downloads models on first run; $0.01/session)
            try? await AmigoFaceSwap.initialize(apiKey: "your-api-key") { progress in
                print("Downloading: \(Int(progress * 100))%")
            }
            // Enroll the source face you want to wear on the live camera
            latent = try? await AmigoFaceSwap.enrollFace(from: sourcePhoto)
        }
    }
}

Quick Start — Live Camera (UIKit)

import AmigoFaceSwapSDK

Task {
    try await AmigoFaceSwap.initialize(apiKey: "your-api-key")
    let latent = try await AmigoFaceSwap.enrollFace(from: sourcePhoto)
    let vc = AmigoLiveViewController(targetLatent: latent)
    present(vc, animated: true)
}

Quick Start — Static Image

let latent = try await AmigoFaceSwap.enrollFace(from: sourcePhoto)
let swapped = try await AmigoFaceSwap.swapFace(in: targetPhoto, using: latent)
imageView.image = swapped

Next Steps