Overview
syni-swift is the iOS / macOS consumer SDK for Syni. Same agent surface as the Flutter sibling and the Kotlin sibling, idiomatic for Swift (async/await, AsyncThrowingStream<SyniChatEvent, Error> for streaming, Combine AnyPublisher<SyniInstallState, Never> for the install lifecycle).
Platform support
- iOS 16.0+ · macOS 13.0+
- Swift 5.9+ · Xcode 15+
- Native runtime delivered by the
synheartCLI asSyniRuntime.xcframework(see install steps below)
Installation
Swift Package Manager
CocoaPods
Native runtime
Both install paths ship Swift sources only. Install the native runtime once with thesynheart CLI:
SyniRuntime.xcframework to <your-project>/synheart/vendor/syni-runtime/.
Add the framework to your Xcode target under General → Frameworks, Libraries, and Embedded Content.
The Swift package resolves all C symbols at runtime via dlsym(RTLD_DEFAULT),
so the package compiles standalone — calls into the runtime fail with a
clear error if the install step hasn’t been run.
Basic usage
Streaming
chatStream returns an AsyncThrowingStream<SyniChatEvent, Error> — token-level .delta events followed by exactly one .final carrying the structured response.
Hybrid local / cloud
SyniExecutionMode cases: .localFirst (default), .cloudFirst, .localOnly, .cloudOnly.
Install lifecycle
WireinstallState into SwiftUI to surface progress:
.downloadingModel → .verifyingModel → .loadingEngine → .bindingPersona.
Where this fits
syni-swift is the agent layer — inference, install lifecycle, persona binding, chat orchestration. It does NOT own:
- HSI signal collection (the synheart-core SDK does), or
- the four-authority gate (consent + capability + activation + session; also a host concern).
SynheartCore and use SyniModule, which wraps this SDK with those layers. Standalone use of Syni is fully supported when you don’t need the wider Synheart contract.
Models
Out-of-the-box GGUF models exposed underSyniModels:
qwen25_15bInstructQ4(default, ~1.5 GB)qwen2_05bInstructQ4(~500 MB)gemma3_1bInstructQ4
SyniModelSpec. Swift also supports Apple Foundation Models as an execution target where available (.appleFoundationModels in RoutingPolicy.preferredEngines).
API reference
| Surface | Notes |
|---|---|
SyniAgent | Constructed with optional installer / cloudConfig. Exposes installState / currentState / isInstalled / hasCloud. |
SyniAgent.install / restoreInstallIfReady / uninstall / dispose | async / throws; emit install-state transitions. |
SyniAgent.chat / chatStream | async throws / AsyncThrowingStream<SyniChatEvent, Error>. |
SyniInstallState | Enum: .notInstalled, .installing(stage:progress:), .installed(...), .failed(reason:cause:). |
SyniChatResponse | displayText, message, suggestions, kind (.chat / .coach / .suggestions / .unknown). |
SyniSpecPersona | load(id) — bundled persona JSON. |
SyniModelCatalog | List local + cloud model options; bundled defaults under SyniModelCatalog.bundled. |
SyniCloudConfig | baseUrl, authToken: () -> String?, tenantId, userId. |
SyniExecutionMode | .localFirst, .cloudFirst, .localOnly, .cloudOnly. |
Related
- Syni overview
- Syni spec
- synheart-core/swift — host SDK with
SyniModuleconsent gate