Getting Started
Add RheaKit to a SwiftUI app, point it at the right backend, and render the first control surface.
Getting Started
RheaKit is a Swift Package. The fastest route in is: add the package, set the backend base URL, boot the shared store, then mount the views you actually need.
Requirements
| Requirement | Version |
|---|---|
| Swift | 5.9+ |
| iOS | 17.0+ |
| macOS | 14.0+ |
| Xcode | 15.0+ |
1. Add the package
In your app's Package.swift, add RheaKit as a dependency:
// Package.swift
let package = Package(
name: "MyApp",
platforms: [.iOS(.v17), .macOS(.v14)],
dependencies: [
.package(path: "../packages/RheaKit"),
],
targets: [
.executableTarget(
name: "MyApp",
dependencies: ["RheaKit"]
),
]
)If you prefer Xcode:
- Open
File -> Add Package Dependencies... - Point Xcode at the Rhea repository or the package folder
- Select the branch or revision you want to ship against
2. Confirm the backend target
RheaKit automatically distinguishes between simulator and device:
| Runtime | Default API URL |
|---|---|
| Simulator | http://localhost:8400 |
| Device | https://rhea-tribunal.fly.dev |
You can override it with UserDefaults:
import RheaKit
UserDefaults.standard.set(
"https://your-server.example.com",
forKey: "apiBaseURL"
)At launch, call:
AppConfig.migrateStaleDefaults()That migrates older localhost values off physical devices so you do not strand a production build on an unreachable dev host.
3. Start the shared state spine
RheaStore is the package nerve cord. It owns the core polling loop and recovery logic.
import SwiftUI
import RheaKit
@main
struct MyApp: App {
init() {
AppConfig.migrateStaleDefaults()
RheaStore.shared.startPolling()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}The store polls /agents/status and /health every five seconds, then refreshes heavier SQL-backed surfaces on demand.
4. Gate the app with auth
RheaKit uses AuthManager.shared for JWT state. A user can authenticate or skip, depending on your product policy.
import RheaKit
struct ContentView: View {
@ObservedObject private var auth = AuthManager.shared
var body: some View {
if auth.isLoggedIn || auth.didSkipAuth {
MainTabView()
} else {
AuthView()
}
}
}AuthView already includes sign-in, sign-up, and Apple Sign In plumbing.
5. Render the first control surfaces
Every pane is self-contained. Drop the ones you need into a TabView or mount them individually.
import RheaKit
struct MainTabView: View {
var body: some View {
TabView {
TeamChatView()
.tabItem { Label("Radio", systemImage: "antenna.radiowaves.left.and.right") }
GovernorView()
.tabItem { Label("Governor", systemImage: "gauge.with.dots.needle.67percent") }
TasksView()
.tabItem { Label("Tasks", systemImage: "checklist") }
BioRendererView()
.tabItem { Label("Bio", systemImage: "atom") }
SettingsView()
.tabItem { Label("Settings", systemImage: "gear") }
}
.preferredColorScheme(.dark)
}
}6. Use the package visual language
Use RheaTheme tokens and .glassCard() for your own custom panes so they read as native Rhea surfaces.
import RheaKit
struct MyDashboard: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
Text("Status: Online")
.foregroundStyle(RheaTheme.green)
Text("Queries today: 42")
.foregroundStyle(RheaTheme.accent)
}
.glassCard()
.background(RheaTheme.bg)
}
}