The smallest possible ManifoldKit app — one call to bootstrap, one view.
import SwiftUI
import ManifoldKit
import ManifoldUI
@main
struct MinimalExampleApp: App {
@State private var result: QuickStartResult?
@State private var error: ManifoldKitError?
@State private var showModelManagement = false
var body: some Scene {
WindowGroup {
if let result {
NavigationStack {
ChatView(showModelManagement: $showModelManagement)
}
.environment(result.viewModel)
.modelContainer(result.bootstrap.modelContainer)
} else if let error {
ContentUnavailableView("Failed to start", systemImage: "exclamationmark.triangle", description: Text(error.errorDescription ?? ""))
} else {
ProgressView().task {
do { result = try await ManifoldKit.quickStart() }
catch let e as ManifoldKitError { error = e }
catch { self.error = .from(error) }
}
}
}
}
}ManifoldKit.quickStart() builds the SwiftData container, registers the
compiled-in backends, and wires up a ChatViewModel. On first launch (no
persisted sessions) it auto-creates an initial empty session and activates
it, so ChatView's composer is enabled the moment the view appears. Errors
surface as ManifoldKitError — see MinimalExampleApp.swift for the
explicit handling shape.
- From
Example/Examples/, runxcodegen(if you haven't already). - Open
ManifoldExamples.xcodeprojin Xcode. - Pick the MinimalExample scheme and run on Mac or an iOS simulator.
Sources/ManifoldKit/QuickStart.swift— whatquickStart()actually does.Example/Advanced/— the advanced reference app (sessions, model management, custom composer accessories, etc.).- Drop down to
ManifoldBootstrap.build(...)directly if you need a custom inference service, model container, or non-default backend mix.