Skip to Content
Octapus

Rendering

Why native screens match the web build, and what the platform views actually do.

Most cross-platform frameworks map your components onto platform widgets and let each platform lay them out. That is why the same app looks a little different on every platform. Octapus does the opposite: one shared engine computes everything that decides how a screen looks, and AppKit and UIKit only display the result.

The shared engine

StepWhat it does
CSSA cascade modeled on WebKit: the same browser default stylesheet, selectors, specificity, inheritance, custom properties, media queries and computed values that Safari's getComputedStyle reports
LayoutBrowser-compatible block, flex and grid layout of an html > body > #root page
TextLine breaking, line height, alignment, letter spacing and decorations, built on CoreText. Measuring and drawing use the same code
PaintingBackgrounds, borders, rounded corners, text and inline SVG, painted with CoreGraphics

The engine runs identically on macOS and iOS. A screen drawn from the snapshot and the same screen after your app takes it over go through the same painter, so they produce the same pixels.

What the platform does

AppKit and UIKit views are thin hosts. For each element that needs a view, the renderer creates one (or reuses one), sets the frame the engine computed, and asks the engine's painter to draw into it. The platform contributes what only it can: real text fields, scrolling, input events, and the device's fonts and color scheme.

Buttons and text fields start from one shared control stylesheet on every target, the browser included, so a button is the same box everywhere until your CSS says otherwise.

Hermes and your app

Your app runs on Hermes, compiled ahead of time to bytecode, so there is no parse or compile step at launch. Each Octapus view owns its own runtime, and JavaScript runs on a dedicated thread; your app's updates arrive on the main thread as batches of changes to the element tree, which the engine restyles, lays out and the renderer applies.

The Swift modules you import talk to Hermes through a small C interface. That is why adding Octapus to an app does not require turning on Swift/C++ interop.

On this page