iOS SDK (SPM)

Swift Package Supportal — SwiftUI chat, help center, SSE streaming, WebSocket handoff. iOS 16+.

Install (Swift Package Manager)

swift
// Package.swift
dependencies: [
    .package(path: "sdks/ios"),
],
targets: [
    .target(name: "MyApp", dependencies: [
        .product(name: "Supportal", package: "Supportal"),
    ]),
]

In Xcode: File → Add Package Dependencies → Add Local… → select sdks/ios. Supportal re-exports SupportalCore and SupportalUI.

Configure

swift
import SwiftUI
import Supportal

@main
struct MyApp: App {
    init() {
        Supportal.configure(
            host: URL(string: "https://support.clientname.app")!,
            identityTokenProvider: {
                try await MyBackend.identityToken()
            },
            primaryColor: SupportalColor(hex: "#2d6e50")
        )
    }

    var body: some Scene {
        WindowGroup {
            SupportalRootView()
        }
    }
}

host is the tenant origin; the SDK appends /api/v1. Use SupportalChatView(), SupportalHelpCenterView(), or Supportal.present(from:) for UIKit.

Identity provider

Return a fresh HS256 JWT from your backend when the SDK exchanges a session. Return nil for logged-out users (anonymous session). Identity JWTs expire within 24 hours.

Capabilities

  • Help center browsing (categories and articles).
  • Streaming chat via URLSession bytes (SSE).
  • Refund confirmation cards and custom action confirmations.
  • Live agent messages over URLSessionWebSocketTask during human handoff.
  • Session token in Keychain; refreshed before expiry.