Write and run SwiftUI
in any browser.

Real SwiftUI with live preview — plus a debugger, SwiftData, and Foundation — running 100% in your browser. No Mac. No Xcode. No server.

miniswift.run/studio
MiniSwift Studio — editor with a live SwiftUI preview
Live SwiftUI preview Console REPL File management Autocomplete ⌘K palette Shareable links
Headline · the entire SwiftUI runtime in your tab

SwiftUI, compiled in your browser.

Plain Swift source — including @State, NavigationStack, Toggle, Path, the works. Hit a tab and our in-browser compiler tokenises, parses, type-checks, and lowers to UIIR — then the canvas renderer paints it onto a real iPhone frame. Tap a button → @State mutates → an identity-aware diff engine rebuilds only the affected subtree. No iframe, no JS shim, no native runtime — just Swift → C compiler → WASM → canvas pixels. The same pipeline you'd ship to a phone, running in your tab.

Counter.swift edit · live @State · button
swift → lexer → parser → sema → uiir → canvas
Live preview tap the buttons

Our compiler. Our UIIR. Our renderer. Our diff engine. All under one roof in 71K lines of C — no React, no Web Components, no proprietary runtime. The same pipeline you'd target a phone with, just landing on a canvas instead of CoreAnimation. Open in Studio →

Bonus · MSL → WGSL on the side

Metal, too.

Because once you have your own compiler infrastructure, why stop at Swift? libMetal tokenises Apple MSL, lowers to MIR, emits WGSL — WebGPU paints the fragment. Edit the shader, move the mouse, watch it react. Same C-only philosophy: no LLVM, no third-party transpiler.

Tunnel.metal edit · live polar coords
metal → lexer → parser → mir → wgsl → webgpu
WebGPU canvas atan2 + fract

The 177 KB libMetal WASM tokenises ~106 keywords, lowers to MIR with 90+ builtin rewrites, then emits WGSL plus a JSON pipeline-metadata sidecar — the same library you'd link against in C. Open in Studio →

71K
Lines of C
compiler · stdlib · foundation · swiftui · metal
52
SwiftUI Views
stacks · shapes · paths · canvas · maps
75
Modifiers
layout · style · gestures · sheets · alerts
0
Dependencies
no npm · no llvm · no clang

Everything You Need to Run Swift

Full Language Support

Structs, classes, enums, protocols, generics, closures, async/await, error handling, pattern matching — all compiled to WebAssembly.

Standard Library

Array, Dictionary, Set, String (Unicode 17.0), Optional, Result, Range — 290 runtime functions with 180+ inlined method handlers.

Foundation

Date / Calendar arithmetic + formatting, URL components & resolution, JSON encode/decode, UUID, UserDefaults, Unicode tables — 70+ runtime functions exposed via a JS bridge.

Metal Shaders

Compile MSL (Metal Shading Language) to WGSL right in the browser. vec3 / mat4 math, mesh primitives (cube · sphere · plane · grid), camera + location passthrough — runs on WebGPU.

WebAssembly Backend

Direct IR-to-WASM compilation. No LLVM, no clang, no Binaryen. Structured control flow, dead code elimination, constant folding.

Plugin Architecture

Modular design: compiler core knows zero about stdlib. Modules register type declarations, IR handlers, and WASM builtins via plugin API.

SwiftUI Runtime ★ headline

The whole declarative UI surface — 52 views, 75 modifiers, sheets, alerts, gestures, Path & Canvas drawing — rendered to canvas via our own UIIR JSON. Identity-aware diff engine surgically rebuilds just the affected subtree on every @State mutation. Same Swift code you'd ship to a phone, no edits.

751 Tests, 100% Pass

Comprehensive test suite covering collections, concurrency, generics, error handling, strings, numerics. Zero regressions policy.

Compiler Pipeline

.swift
Lexer
Parser
Sema
IR Gen
SSA
Optimizer
WASM
.wasm

Frequently Asked Questions

Do I need a Mac or Xcode?

No. MiniSwift runs entirely in your browser — Windows, Linux, Chromebook, even a phone. Nothing to install, no account needed.

Is this real Swift, or a sandbox calling a server?

Real Swift. It's a from-scratch Swift compiler that runs 100% in your browser — no server compiles your code. It covers a large subset of Swift, SwiftUI, Foundation, SwiftData and more (it isn't an Xcode replacement — see what's supported below).

Where does my code run? Is it private?

In your own browser tab. Your code is compiled and executed entirely client-side — nothing is uploaded to a server. That's also why there's no setup and no waiting.

Is it free?

Yes — Studio is free to use. If you want to embed live, runnable SwiftUI in a course, product or docs commercially, get in touch.

Can I use it in my course, docs or blog?

That's exactly what it's for. You can embed live, runnable SwiftUI examples so your readers and students run and tweak them right there — no Mac required. (Embeddable widget is on the way; reach out if you want early access.)

What's not supported?

It's a large subset, not all of Swift/SwiftUI — some advanced APIs aren't there yet. The coverage pages (SwiftUI · stdlib · Foundation · Metal) show exactly what works.

How is it built?

A Swift compiler, SwiftUI runtime, Foundation bridge and Metal shader compiler — all written from scratch in C, compiled to WebAssembly. No LLVM, no Apple runtime, no third-party dependencies.