Export & Handoff
Copy as SwiftUI and CSS
A design is handed over as numbers: sizes, gaps, colors, radii, the variables they follow. Nox writes those numbers as SwiftUI and CSS, so whoever builds the screen starts from the design's own values instead of measuring a picture. An agent can go further: read a whole screen as a build spec, write the code, and hold a screenshot of the result against the design.

Copy as#
- Right-click a layer on the canvas.
- Choose Copy as › SwiftUI or Copy as › CSS. The code is on the Mac's pasteboard.
- For an icon or a mark, Copy as › SwiftUI Shape copies its outlines as a struct. See Check and export icons.
The Lighting & Depth section of the inspector, when open, has its own Copy SwiftUI and Copy CSS buttons.
Show code in Review#
Review is for reading a design without changing it, and it is where code is shown.
- Press ⌘2 for Review.
- Select a layer. The pointer in Review, Inspect (V), selects and never moves anything.
- Press Code in the top bar, or ⌥C. A panel opens with SwiftUI and CSS side by side as tabs.
- Press Copy.
Measure (M) is beside it in Review, for the distances between layers. Both Copy as and Code are in Nox Free.
What the code says#
The code is the selected layer's own properties, written out: its size and how it sizes, its layout, padding, fill, corners, stroke and shadow. Layers inside it are not written out; a comment says how many there are. It is a start to build from, and its numbers are exact.
A property that follows a variable is written through it, with the value after it in case the variable is missing. This is the button of a card whose fill and radius follow two variables:
width: fit-content;
height: fit-content;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 12px 20px 12px 20px;
background: var(--color-accent, #2F6BFF);
border-radius: var(--radius-button, 12px);
The code uses the names; the variables themselves come from export_tokens, below. A component with states, such as Normal, Pressed and Disabled, ends its CSS with a rule for each other state holding only what that state changes. See Button states.
The inspect tool#
An agent reads one layer with inspect. It gives the same CSS and SwiftUI, and the measurements a builder needs.
How far is the button from the text above it, and what does it follow?
The agent calls inspect with:
{ "node": "1217938636:6", "to": "1217938636:5" }
From the reply:
{
"box": { "x": 48, "y": 236, "width": 124.36, "height": 42 },
"in_parent": { "left": 24, "top": 116, "right": 193.64, "bottom": 24, "parent": "1217938636:3" },
"distance": { "down": 12, "across": null, "left": 0, "top": 56 },
"follows": {
"fill": { "name": "color/accent", "css": "--color-accent" },
"corner_radius": { "name": "radius/button", "css": "--radius-button" }
}
}
box is on the page; in_parent is the distance to each edge of the card; distance.down is the gap to the text: 12. left_out names anything the code could not say.
Variables as tokens#
export_tokens writes every variable of the document as code: css (custom properties), swift (a Tokens namespace with each set's modes) or json (Design Tokens Community Group form). Give it a path to write a file, or leave it out to have the text in the reply. In CSS, the default mode is in :root and each other mode holds only what differs:
:root {
--color-bg-card: #FFFFFF;
--color-text-primary: #111827;
--color-accent: #2F6BFF;
--radius-button: 12px;
--space-card: 24px;
}
[data-theme="dark"] {
--color-bg-card: #1E2128;
--color-text-primary: #F2F4F7;
--color-accent: #6E9BFF;
}
{ "format": "css", "path": "/Users/you/Projects/web/tokens.css" }
In Swift each token is a function of the modes in force, and a view reads those from its environment. The SwiftUI that Nox writes calls the tokens that way, so it compiles beside the token file as it is:
struct PayButton: View {
@Environment(\.tokenModes) private var tokenModes
var body: some View {
RoundedRectangle(cornerRadius: Tokens.Number.radiusButton(tokenModes))
.fill(Tokens.Color.accent(tokenModes))
.frame(width: 120, height: 40)
}
}
Set the modes for a whole screen with .environment(\.tokenModes, modes). Variables are covered in Variables and modes.
A screen as a build spec#
To build a whole screen, an agent asks for it in one reply with get_design_spec. The screen must be on the page shown.
{ "node": "1217938636:3", "scales": [2, 3] }
It gives back:
tree: the node and everything visible in it, with every property and aboxmeasured from the screen's top-left corner;colorsandtypographyused, with how often;tokens: each variable followed, its code names, and its value in every mode;assets: the layers to write out as files, pictures and drawn shapes, with the namesexport_assetswould give them;stateandstatesfor a component that has them.
Tell the agent to write code from the tokens' names, not from their values. The screen then follows the theme in the built app as it does in Nox.
Check the build against the design#
Once the screen is built, take a screenshot of it alone, cropped to its edges, at any scale. compare_image draws the design at that scale and compares them point by point.

Here is a screenshot of the card as built: /Users/you/Desktop/card.png.
Compare it with the design and fix what differs.
The agent calls compare_image with:
{
"node": "300867026:3",
"image": "/Users/you/Desktop/card.png",
"background": "#F4F5F8"
}
The reply says how much differs and where, the most different first:
{
"differs_percent": 7.78,
"matches": false,
"same_proportions": true,
"where": [
{ "name": "Button", "differs_percent": 92.62, "design_colour": "#4178FF", "built_colour": "#5B53E6" },
{ "name": "Label", "differs_percent": 76.28, "design_colour": "#5C8BFF", "built_colour": "#756EEA" }
]
}
With it comes a picture of the design, faint, with every differing point in red. The agent reads the exact values from get_design_spec, mends the code, and compares again.
A box that differs all over in another color is a wrong color or state. One that differs along an edge is out of place or another size. Text that differs is another font, size or wrapping. tolerance (24 by default, of 255) allows for two renderers never smoothing edges alike, and mode draws the design in a mode such as "Theme=Dark", to hold beside a screenshot of the app in dark.