ManifoldKit

A Swift package for adding an AI chat product to iOS and macOS apps: a SwiftUI chat view, a turn loop, SwiftData persistence, and local or cloud backends behind one protocol.

View on GitHub ↗
Stars
★ 11
Last commit
21 Nov 2026
Maintenance
Active
Licence
MIT
Category
On-device AI SDKs
GitHub
ManifoldKit/ManifoldKit

Overview

ManifoldKit is a multi-backend AI chat framework for iOS 26 and macOS 26. Import one umbrella package and you get a SwiftUI ChatView, the ConversationRuntime turn loop (send, regenerate, edit, cancel and branch) and SwiftData persistence. Built-in backends for Apple Foundation Models, OpenAI, Anthropic and Ollama sit behind one InferenceBackend protocol. On-device MLX and llama.cpp come as separate companion packages, so an app that only needs the core never pulls them in.

The README describes it as the only open-source Swift package that bundles UI, runtime, persistence and multi-backend inference into one drop-in chat product. It also sets out to handle real-world failures, with streaming retries, certificate pinning and a mock backend for app tests. ManifoldKit is pre-1.0, so breaking changes can land between minor versions.

ManifoldKit was called BaseChatKit before version 0.20.

ManifoldKit is licensed under the MIT licence.

Features

  • ManifoldKit.quickStart() builds the SwiftData container, registers backends, restores or creates a session and picks a usable model.
  • A drop-in ChatView, or parts to compose your own layout, such as MessageBubbleView, ChatInputBar and SessionListView.
  • Token streaming, tool calling with a human approval gate (ToolApprovalGate), reasoning tokens and structured output on every backend.
  • An MCP client, and an MCP server mode (ManifoldMCPHost) that exposes your app's tools to outside MCP clients.
  • On-device RAG with citations, for .txt, .md and .pdf documents, with optional reranking.
  • On-device embeddings with Apple's NaturalLanguage framework.
  • On-device image generation (FLUX.1 Schnell and SDXL Turbo) through the manifold-mlx companion package.
  • Any OpenAI-compatible endpoint, such as xAI, Groq, Mistral or OpenRouter, through APIProvider.custom.
  • A standalone OpenAI-compatible server, manifold-server, installable with Homebrew.
  • Optional modules for voice, App Intents, Hugging Face and a model browser UI.

Requirements

  • Swift 6.1 or later.
  • iOS 26 or later, or macOS 26 or later.
  • The Foundation Models backend needs Apple Intelligence to be enabled.
  • API keys for any cloud backends you use.

Install

  1. In Package.swift, add .package(url: "https://github.com/ManifoldKit/ManifoldKit.git", from: "0.79.1"), then add the ManifoldKit product to your target.

  2. For on-device models, also add https://github.com/ManifoldKit/manifold-llama (GGUF, product ManifoldLlama) or https://github.com/ManifoldKit/manifold-mlx (MLX, product ManifoldMLX).

  3. For the standalone server, run brew tap manifoldkit/manifoldkit https://github.com/ManifoldKit/ManifoldKit.git, then brew install manifold-server.

Example

In your app's entry point, call try await ManifoldKit.quickStart() in a task, then show ChatView with the result's view model and model container. To start with a small on-device model, add manifold-llama and call quickStart(backends: [LlamaBackends.self], seed: .recommendedSmallModel()). The README says this downloads Qwen3-0.6B (about 484 MB). For a single reply as a string, call respond(to:) on the result.

The runnable starting point is the MinimalExample app in the repo's Example folder.

Works with

Not stated by the source

Listed in

Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.

Report a correction

More in this category