Runtime
The Reactive and Context machinery the rendered code links against.
Contents
How a Program becomes Swift, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Swift target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the Swift it renders to.
- Naming considerations — how Program's dotted names are carried into Swift.
- Entry point — starting a program and mounting it as a SwiftUI app.
- Drivers — the native drivers that provide the interface, animation and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written Swift behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Swift.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Swift keeps for itself, and how a colliding name is escaped.
Reactive and Context, in Swift
The runtime is the same three parts as every
target — the Reactive graph, the Context channels, and the native drivers — ported to
Swift. State is Reactive.State<T>(…), a value is a
ReactiveValue<T> (a class, for reference identity across cycles), and derived
values come from Reactive.Calculate { … }.
Swift's value types map cleanly: a record becomes a struct and a union an
enum, both carrying Program's types through real generics. The cycle (open channels,
run, drain, dispatch, wait) is identical; read the
JavaScript runtime for the full walkthrough.