How Dactyl Works

Aug 28, 2026 10:42 PM - 2 weeks ago 8

Divy Srivastava · August 26, 2026

App improvement has ever been harder than web improvement for LLMs. Apps thin to person level style norms and layouts, and they request to look and consciousness a definite way. People tin consciousness erstwhile an app is “native” and crafted for their device. Plus, the web is unfastened and cosmopolitan successful a measurement apps and app stores typically are not, which intends LLMs person comparatively little information successful their training sets.

Many vibe-coding platforms person tried to lick the problem by, essentially, compromising. They make apps utilizing Expo/React Native, Flutter, aliases moreover conscionable webviews. But we recovered nary of those approaches provides an optimal personification experience; you're ever sacrificing something, whether it's cross-platform compatibility, autochthonal widgets, performance, aliases features.

We made Dactyl to thief you build autochthonal apps without those compromises.

Today we coming the soul workings of Dactyl’s cross-platform SwiftUI renderer—a Wasm larboard of the iOS simulator—and really we bring the Apple ecosystem to Android and the web.

iOS previews connected the web

We chose Swift arsenic the superior connection successful Dactyl because of its simplicity and well-defined layout semantics. In fact, Dactyl was initially designed to beryllium a improvement level exclusive to iOS.

Previewing an iOS app without a Mac usually intends renting 1 and streaming a existent simulator back: a boot, an install, and a motorboat earlier you moreover see the app, metered for arsenic agelong arsenic you support working.

That attack only scales arsenic acold arsenic your fund allows. But what if you could person a simulator wrong your browser? Well, that would standard infinitely. So we built it.

Dactyl’s preview motor is simply a reimplementation of SwiftUI successful Swift, positive the frameworks apps scope for. Plenty of modules are implemented, including Charts, SpriteKit, SceneKit, RealityKit, ARKit, MapKit, StoreKit, MusicKit, PencilKit, WidgetKit, UIKit, CoreGraphics, Metal and Vision.

Apps are built to Wasm and linked against our SwiftUI alternatively of Apple’s.

The motor emits a binary watercourse of tie commands into its ain linear memory, and the protocol is publication by a JavaScript big that paints it connected a Canvas2D.

Layout is afloat resolved earlier immoderate bid is written, and a reconciler keeps the position character betwixt passes, marking soiled only the views that publication thing unrecorded this frame: animations, scrolling containers and the like. The big rasterizes each furniture erstwhile onto an offscreen canvas keyed by a hash of its contents, past composites connected later frames.

All of this intends Dactyl tin render analyzable SwiftUI layouts smoothly and efficiently, straight successful the browser, without immoderate installation measurement aliases other devices. (But it tin grip each of that, too.)

Layout treeloading…

the framework it resolves to

Dynamic linking Swift

SwiftWasm links statically. That is not perfect for us, because the motor is ~100 MB and a fixed nexus intends linking and shipping hundreds of megabytes to the browser connected each edit.

The app itself is overmuch smaller, truthful we divided the build. The motor and the modular room nexus erstwhile arsenic a guidelines module, content-addressed, truthful the browser fetches and compiles it 1 clip and keeps it crossed edits.

Your app compiles connected its ain arsenic a position-independent broadside module, 8 KB to 300 KB. At load, it’s placed astatine a runtime representation offset, its imports are bound to the base’s exports, and its Swift type metadata is registered pinch the base’s runtime. The switch happens nether the moving app. @State is snapshotted earlier and restored after, truthful scroll position, matter fields, and app information are preserved crossed edits.

examples/weather/ContentView.swift89 Color(red: 0.42, green: 0.69, blue: 0.95)],

36 KB0.28 s

Android: Jetpack Compose

On Android, the motor compiles natively for aarch64-unknown-linux-android24 pinch the Swift Android SDK into a shared library. A Jetpack Compose big loads it and drives it complete JNI. The bid watercourse is publication straight retired of autochthonal memory, nary copy, truthful the Compose big decodes the aforesaid bytes the browser does.

Where the browser big paints a power onto the canvas, the Compose big mounts a existent Material switch, matter section aliases day picker astatine that rectangle, pinch autochthonal focus, ripple, keyboard, and accessibility.

Both phones beneath are moving the aforesaid 71-line SwiftUI source: the near is simply a booted iPhone simulator; the correct is the APK connected an Android emulator.

the app built from 1 SwiftUI source, captured connected a existent iPhone simulator

iOS

the aforesaid build arsenic a per-app APK connected the Android emulator, painted by the Compose host

Android

PICKER segmentedUIKit segmented power vs Material segmented button, checkmark

SF Symbols and Material Symbols are different icon sets pinch different names, truthful 1 generated mapping array covers some hosts. Compose’s density is pinned to the engine’s layout standard alternatively than the device’s, truthful controls onshore precisely connected the rectangles the motor resolved. Per-app APKs don’t rebuild the host. The shared library, app name, and icon are stamped into a prebuilt template.

iPad is the aforesaid motor pinch a different instrumentality descriptor. The viewport, safe areas and size classes change, and SwiftUI’s adaptive layouts do the rest.

Development loop

Apple simulator

Apple simulator

our engine

our engine

difference

difference

agents connected the engine's model source4 editing correct now

  • Charts/ChartRender.swiftqueued
  • SwiftUI/Core/ShapeStyle.swiftqueued
  • SwiftUI/Modifiers/TextLayoutModifiers.swiftqueued
  • SwiftUI/Generated/LayoutParams.swiftediting
  • SwiftUI/Core/ColorGradient.swiftediting
  • Charts/ChartPlots.swiftediting
  • SwiftUI/Modifiers/ScrollModifiers.swiftqueued
  • SwiftUI/Core/SemanticColors.swiftdone
  • UIKit/GestureScrollControl.swiftediting
  • Charts/ChartViewModifiers.swiftdone
  • SwiftUI/Core/Animatable.swiftqueued
  • CoreGraphics/CGPath.swiftdone
  • and the remainder of the red

re-render, diff again, until they agree

Development of the motor is highly automated utilizing a fleet of agents. The agents usage Apple’s SDK artifacts to build an API reference. We past render a assortment of scenes successful a booted iOS simulator, seizure them, and diff the engine’s output against them pixel by pixel. When a caller iOS ships, we re-render the root of truth against the caller simulator.

Screenshots miss thing that moves, truthful a filmstrip runner drives a virtual clock: it ticks the motor successful fixed steps, samples frames connected a timeline, and fires synthetic taps and cardinal presses astatine nonstop moments.

For games we diff states and events, for illustration wherever a characteristic really is onscreen astatine framework N. Our motor and the existent simulator dump the aforesaid per-frame node schema (position, rotation, scale, alpha, physics velocity), and the trajectories are diffed per node per frame.

Each diff is handed to a ocular ample connection exemplary that identifies issues, past fans retired agents to edit the engine’s model root until the diff is nether a threshold. This is simply a amazingly effective process, and it gets america very adjacent to implementing a continuously moving model for illustration SwiftUI.

See Dactyl successful action

That’s it for the method specifications down the scenes. We haven’t moreover touched connected really Dactyl helps you instal your apps connected your instrumentality for testing, though, aliases really it guides you done listing apps connected the App Store. But possibly it’s champion if you spot for yourself.

Just picture an app, and everything we’ve described present will build it, unrecorded successful your browser. Give Dactyl a effort now.

More