Working draft · not a standard · no release

Describe a design system once.Compile it to native code.

DSF is an open, plain-text format for tokens, components, accessibility and examples; its compiler, dsfc, checks the source and generates SwiftUI, Angular, DTCG JSON and documentation.

Read the documentationView on GitHub

How it works

  1. Sources

    .dsf files

    tokens, components, icons, usage rules, examples

  2. Compiler

    dsfc

    check · test

  3. Outputs

    • SwiftUI
    • Angular
    • DTCG JSON
    • Docs

    native code, token JSON, static documentation

A package of .dsf files is checked and tested by dsfc, then generated for each target.

One source, native output

Excerpts of a real component from the conformance scenarios, and of the SwiftUI code dsfc generates from it.

button.dsf — written by hand (excerpt)
component "Button" {
  property "label" {
    type = "string"
  }

  property "disabled" {
    type    = "boolean"
    default = false
  }

  variant "appearance" {
    values  = ["primary", "secondary"]
    default = "secondary"
  }

  event "activate" {}

  accessibility {
    role     = "button"
    name     = prop.label
    disabled = prop.disabled
  }

  # states, slot, view and overrides omitted

  on "activation" {
    when = !prop.disabled
    emit = event.activate
  }
}
DSButton.swift — generated by dsfc (excerpt)
// Generated by dsfc from calculated-button 0.1.0 (IR 0.1.0-draft). Do not edit.
public enum DSButtonModel {
    public enum Appearance: String, Hashable, Sendable, CaseIterable {
        case primary = "primary"
        case secondary = "secondary"
    }
    // Props, Variants, States, resolve(...) omitted

    public static func handle(
        _ input: Input, _ props: Props, _ variants: Variants, _ states: inout States,
        _ context: DSContext
    ) -> [Event] {
        var events: [Event] = []
        switch input {
        case .activation:
            if !props.disabled {
                events.append(.activate)
            }
        }
        return events
    }
}

// In DSButton.body: the DSF view is drawn inside the native control.
SwiftUI.Button {
    dispatch(.activation, context)
} label: { /* DSButtonBody */ }
.disabled(a.accessibilityDisabled)
.accessibilityLabel(Text(a.accessibilityName))

Why DSF

  • One source of truth

    Tokens, components, states, accessibility and usage rules live in one package of readable files, reviewed like code.

  • Native code, native accessibility

    Roles map to platform controls: a button becomes a SwiftUI.Button on macOS and a native <button> in Angular.

  • DTCG interchange

    Tokens follow DTCG 2025.10 and convert to and from JSON. Export fails rather than silently dropping data.

  • Examples are tests

    Examples run with dsfc test and become tests of the generated code: Swift Testing and XCTest on SwiftUI, Vitest on Angular.

Where it stands

DSF is a working draft, not deployed or released. The SwiftUI and Angular generators build all 14 conformance scenarios and two unofficial ports of public design systems. Every example runs in dsfc test; those the generators translate also run as Swift Testing, XCTest and Vitest tests, and the on-screen ones that need macOS keyboard navigation are skipped without it.

Status and roadmap