One .tsx file. A website, an iPhone app and an Android app.
Write a component once in TypeScript. Pyreon renders it fine-grained on the web and compiles it to real SwiftUI and real Jetpack Compose, so each phone draws it with its own UI toolkit. The native targets are experimental, and this page says exactly what that means.
npm create @pyreon/multiplatform@latest Same source. Three idiomatic outputs.
The counter every new multiplatform project starts with. On the web, Vite builds it against @pyreon/runtime-dom. Through pyreon-native, the same file becomes SwiftUI and Compose that Xcode and Gradle build like any other code.
// src/App.tsx, as scaffolded by @pyreon/create-multiplatform
import { signal } from '@pyreon/reactivity'
import { Stack, Text, Button } from '@pyreon/primitives'
export function App() {
const count = signal(0)
return (
<Stack gap="md" align="center">
<Text data-testid="count">{count()}</Text>
<Button data-testid="increment" onPress={() => count.set(count() + 1)}>Increment</Button>
</Stack>
)
}struct App: View {
@State private var count: Int = 0
var body: some View {
VStack(alignment: .center, spacing: 12) {
Text(verbatim: "\(count)").accessibilityIdentifier("count")
Button("Increment") { count = count + 1 }.accessibilityIdentifier("increment")
}
}
}@Composable
fun App() {
var count by remember { mutableStateOf(0L) }
Column(verticalArrangement = Arrangement.spacedBy(12.dp), horizontalAlignment = Alignment.CenterHorizontally) {
Text(text = "${count}", modifier = Modifier.testTag("count"))
Button(onClick = { count = count + 1L }, modifier = Modifier.testTag("increment")) {
Text("Increment")
}
}
}Unedited compiler output, minus the import preamble and a one-line Kotlin helper. A signal becomes @State on iOS and mutableStateOf on Android; data-testid becomes an accessibility identifier and a test tag.
Experimental, stated plainly.
The multiplatform docs call PMTC, the Pyreon Multi-Target Compiler, "experimental — demo-quality, not production-ready". We mean it. The web framework is Stable; the native targets are Experimental.
What is device-proven is measured, not described: the multiplatform page carries a weighted capability matrix that credits a capability only when a test on a real iOS Simulator or Android emulator asserts it, and a CI gate recomputes the headline from the table. Check the rows your app needs before you commit.
Your primitives become their platform's own views.
- iOS:
<Stack>VStackAndroid:Column - iOS:
<Inline>HStackAndroid:Row - iOS:
<Field>TextField(SecureFieldfor passwords)Android:TextField - iOS:
<Toggle>ToggleAndroid:Switch - iOS:
<Modal>.sheetAndroid:Dialog - iOS:
<Scroll><For>ScrollView { LazyVStack }Android:LazyColumn - iOS:
signal/computed@State/@ObservableAndroid:mutableStateOf/derivedStateOf
What lowers to native.
PMTC compiles your component source. It does not transpile npm packages to Swift or Kotlin: a package reaches the phone when its logic has a Swift/Kotlin runtime port the compiler recognises.
The canonical primitives
Stack, Inline, Scroll, Text, Button, Field, Toggle, Modal and the rest, each with a real DOM implementation on the web and SwiftUI and Compose output natively. The next release brings the set to 22 with Select, Tabs, Split, Canvas and Gesture.
The reactive core
signal, computed, typed props, <For>, <Show>, if and ternaries, array and string methods, object types as structs and data classes.
Logic packages with native ports
@pyreon/store, machine, state-tree, i18n, permissions, form, storage, flow, the router, and @pyreon/charts, which draws to a native canvas.
Device hooks
useFetch, useOnline, useAppState, useClipboard, useColorScheme, useGeolocation, useHaptics, useShare. For anything else, useNativeModule('Name') compiles to a Swift or Kotlin class you write.
New on main, shipping in the next release.
Plain TypeScript that used to stop a native build now compiles. Each lowering is documented row by row on the multiplatform page.
effect() in a component bodynext release
Runs when the view appears and again when a signal it reads changes (.onAppear + .onChange(of:) on iOS, a keyed effect in Compose). A returned cleanup runs as on the web.
Timersnext release
setTimeout, setInterval and their clear… twins lower to a PyreonTimers runtime. On iOS a timer keeps firing during a scroll, as in a browser.
Date, enums and module-scope signalsnext release
new Date(…), Date.parse, the getters and toISOString lower (a date is its epoch milliseconds). String enums become native enums. A file's module-scope signal() / computed() become one observable singleton per file.
throw, try / catch / finally, JSON.parsenext release
Error handling lowers in helper, handler and computed bodies. JSON.parse becomes a typed, throwing native decode, and a @pyreon/validate schema's .parse(x) returns the same { ok, value, issues } it returns on the web, never throwing.
<Select> and date/time <Field>next release
<Select> uses each platform's own picker. <Field kind="date" | "time" | "datetime"> with min / max opens iOS DatePicker and the Material 3 pickers on Android.
More hooksnext release
useDocumentVisibility, usePrevious, useUpdateEffect, useReducedMotion, useKeyboard, useInfiniteQuery, useLatest and a colour-scheme useMediaQuery now lower to iOS and Android.
What stays on the web, and how you know.
Every package manifest declares a multiplatform.tier with a rationale: shared, service-backend or web-only. The docs and the MCP server read the same field. Several web-first packages still lower part of their API, so read each package's tier rather than guessing.
@pyreon/table
The TanStack-backed useTable stays web; the dependency-free createTableState engine crosses.
@pyreon/dnd
The page-wide drag monitor stays web; useSortable, useDraggable and useDroppable cross.
@pyreon/hotkeys
The DOM shortcut registry stays web; the useHotkey hook crosses.
@pyreon/code
CodeMirror is a DOM editor, so it stays web. The <WebView> primitive can host it on a phone with a two-way data bridge.
When the compiler says no, it says why.
Code outside the native subset gets a named warning, per construct and per target, with the fix. The docs say this is what you get "almost always", and check --typecheck runs a real swiftc -typecheck for the rest.
! Totals.tsx [swift] Component Totals: a top-level `for` statement has no native
lowering and was DROPPED — … Move loops/switch into a helper function that takes
parameters (they DO lower there) …
! Totals.tsx [swift] <div> is a DOM/SVG element with no native lowering … Use the
shared vocabulary from `@pyreon/primitives` (Stack, Text, Image, …), keep web-only
markup inside a `<Web>` branch.
checked 1 file(s) [swift, kotlin] — 0 error(s), 4 warning(s)Tested on simulators and emulators, in CI.
Type-checked against SDK stubs
On every PR that touches the native surface, emitted Swift and Kotlin are type-checked.
Built with real Xcode and Gradle
The example apps (
native-todomvc,native-tasks,native-finance, a router demo, a counter) build for real.Driven on devices
iOS — xcodebuildruns XCUITest on a Simulator andAndroid — gradlewruns Compose instrumented tests on an emulator, plus an R8-minified release lane. Both are required checks when native paths change.
From zero to three apps.
Scaffold
Web needs Bun or Node. iOS needs macOS, Xcode and xcodegen. Android needs JDK 17, the Android SDK and
gradleonPATH.npm create @pyreon/multiplatform@latest my-app cd my-app npm installBuild the web first
Layout, logic and styling with hot reload that keeps your module-level signal values. Nothing in the web build needs Xcode or Gradle.
npm run devAsk the compiler, then the device
checkanswers "will this run on the device?" in milliseconds;devrebuilds, reinstalls and relaunches.npx pyreon-native check --watch --source=src npx pyreon-native dev --target=ios
Questions a mobile lead asks.
Is there a JavaScript runtime on the phone?
Not for your UI. The primitives compile to SwiftUI and Compose views. A web-only pane, such as a code editor, can be hosted in the <WebView> primitive when you choose to, and pays WebView startup cost.
Is it ready for production?
No. The native targets are experimental. Use the capability matrix on the multiplatform page to see which capabilities are asserted on devices in CI, and treat the rest as unproven.
Does my AI assistant know the native rules?
The multiplatform scaffold writes AGENTS.md, CLAUDE.md and .mcp.json, and switches on the portable lint rules for src/, so the editor flags non-portable code before you build.
Write it once in TypeScript. Ship it fine-grained to the web, iOS and Android.
npm create @pyreon/multiplatform@latest