Skip to content

Add native Swift SDK for OpenUI Lang and SwiftUI - #1521

Open
zyfn wants to merge 18 commits into
thesysdev:mainfrom
zyfn:codex/swift-sdk-refinement-20261030
Open

zyfn wants to merge 18 commits into
thesysdev:mainfrom
zyfn:codex/swift-sdk-refinement-20261030

Conversation

@zyfn

@zyfn zyfn commented Oct 30, 2026 •

Copy link
Copy Markdown

What

Relates to #393.

This adds Swift support for iOS and macOS apps. Apps can define an OpenUI component library, generate a prompt from it, and render streamed responses with SwiftUI. Actions and tool requests are passed back to the app.

OpenUILang provides Swift bindings to the existing lang-core runtime through JavaScriptCore. OpenUISwiftUI provides the native renderer and components. Apps can use the language module on its own, or select the OpenUISwiftUI product through Swift Package Manager to use both.

Requires Swift 6 tools. Supports iOS 16+ and macOS 13+.

Changes

  • Add Swift APIs for parsing, evaluation, library definitions, prompt generation, and state management.
  • Add native views for the 82 standard component definitions, including layouts, forms, tables, charts, and media.
  • Support incremental rendering while preserving existing views and loaded images. Completed controls can respond before the rest of the output finishes.
  • Add a root SwiftPM manifest, bundled resources, English and Chinese localizations, documentation, regression tests, and a macOS/iOS build workflow.

The language bindings reuse the shared core rather than implementing another parser. The renderer follows the OpenUI component contracts and uses SwiftUI controls and platform interactions. Existing JavaScript packages are unchanged.

Test Plan

Validated on commit 01e175519deb804ed4ac47ec443e28265d616dd4:

  • swift test: 356 tests passed, including parsing, streaming, state, resources, native layout and interaction regressions.
  • Existing conformance, TypeScript, identity, UTF-16 and regex reference cases passed.
  • Strict checks against pinned upstream sources passed for 51 parser snapshots, 5 action traces, 4 query snapshots and 6 serializer round trips.
  • Compiled OpenUISwiftUI for the iOS 16 Simulator target.
  • Checked table edit, reset and save actions in the native review app; one save dispatched one host event.
  • Captured 25 standard-component cases on this revision. Low-speed image playback kept the same measured width before and after completion.

The review application and its scene fixtures are maintained separately from the SDK package. Physical-device testing remains pending.

Screenshots

Six earlier examples rendered by the native iPhone Simulator app. These screenshots predate the current presentation refinements and catalogue cleanup. Prices are sample data.

Day trip Two-day trip
Day trip Two-day trip
Shopping Spending
Shopping Spending
Gathering Learning
Gathering Learning

Checklist

  • Linked the related issue: Native Swift Integration #393.
  • Added installation and API documentation.
  • Considered compatibility with existing packages and component contracts.

lizhu added 3 commits October 30, 2026 14:28
Add OpenUILang, OpenUISwiftUI and OpenUIWeb, matching the pinned OpenUI contracts. Include source-readiness metadata, native resource ownership, adaptive components and SDK regressions.

Keep business scenes, preview hosts and external acceptance outputs outside this SDK-only branch.
Move embedded SVG/WebView presentation into OpenUISwiftUI, retaining explicit registration and application policy. Add a repository-root manifest, packaged resource lookup and installation guidance.
@vercel

vercel Bot commented Oct 30, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the thesys-devs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant