Get started – Swift
FuaranUI is a native Swift surface over the Rust reference core of the
Fuaran UI wire format. The Rust core owns truth and mutation (decode, apply,
render) behind a C-ABI; the Swift side is a render projection: a consumer-grade decoder that parses the core's canonical tree JSON into native
sealed types (NodeKind, the Spec families, TextSource, … as enums with
associated values) for SwiftUI rendering. It never canonically encodes, so
there is no encode leg here – you decode a session's tree and render it.
Install
Add the package in Package.swift and depend on the FuaranUI product:
dependencies: [
.package(url: "https://github.com/fuaran-ui/fuaran-swift.git", from: "0.1.0"),
],
targets: [
.target(name: "App", dependencies: [
.product(name: "FuaranUI", package: "fuaran-swift"),
]),
]
SwiftPM resolves the public git URL directly – no registry step.
Decode a session tree
RenderProjection.decodeNode parses a canonical Node document into the sealed
model; the kind is a native enum you switch over exhaustively – a wire kind
with no arm is a compile error, never a silent fallback.
import FuaranUI
let json = /* the canonical tree JSON the core handed back */
let root = try RenderProjection.decodeNode(json)
guard case .box(let box) = root.kind else { return }
// box.role == .dashboard, root.accessibility?.role == "main"
for child in box.children {
switch child.kind {
case .heading(let h):
print(h.level, h.text) // 2, .literal("Channel performance")
case .markdown(let m):
print(m.text) // .literal("**Hello** from a Fuaran tree.")
default:
break
}
}
Render it
Hand the decoded Node to the SwiftUI FuaranNode renderer (the
FuaranUIRenderer product): its dispatch spine walks the sealed model and
projects each kind into native SwiftUI views, with the interaction loop routing
events back through the core.
The tree it projects
This is the canonical wire the core decodes – rendered here by the reference host, with a one-click link into the playground:
Channel performance
Hello from a Fuaran tree.
{"accessibility":{"role":"main"},"id":"root","kind":{"$type":"Box","children":[{"id":"title","kind":{"$type":"Heading","level":2,"text":"Channel performance","variant":"Standard"}},{"id":"note","kind":{"$type":"Markdown","text":"**Hello** from a Fuaran tree."}}],"layout":{"$type":"Auto"},"role":"Dashboard"}}
Next
- Drive a live session – the
FuaranSessionactor binds the Rust core's C-ABI: seed a tree, apply tree-ops, and re-project, with the core owning mutation and the Swift actor guaranteeing single-owner access. - Where the wire comes from – any codec host emits it. Author it in F#, TypeScript, Go, or Rust.
- See the component reference, the guide, and the host roster.