Show HN: GenUI, native SwiftUI interfaces generated by AI agents
GenUI introduces a secure architecture for generative UI where agents produce declarative A2UI messages rather than executable code, which are then validated against a strict catalog before rendering via SwiftUI. The project utilizes a modular monorepo structure with Git submodules, separating core packages like `genui-kit` (renderer/state) and `genui-components-swift` (design system) from app-specific implementations. It supports a hybrid backend approach, featuring a provider-independent TypeS
Analysis
TL;DR
- GenUI introduces a secure architecture for generative UI where agents produce declarative A2UI messages rather than executable code, which are then validated against a strict catalog before rendering via SwiftUI.
- The project utilizes a modular monorepo structure with Git submodules, separating core packages like
genui-kit(renderer/state) andgenui-components-swift(design system) from app-specific implementations. - It supports a hybrid backend approach, featuring a provider-independent TypeScript runtime and a Cloudflare-hosted gateway, while allowing local development with open-source models via Ollama or llama.cpp.
- The system is currently experimental, with core rendering and offline demos functional, but lacking production-grade features such as authentication, rate limiting, and session resumption in the hosted gateway.
Why It Matters
This approach significantly enhances security in AI applications by eliminating the risk of code injection attacks inherent in traditional agent-based UI generation, as the client never executes arbitrary agent code. It provides a standardized protocol (A2UI) for interoperability between diverse AI backends and native iOS/macOS frontends, potentially becoming a foundational standard for safe generative interfaces in the Apple ecosystem.
Technical Details
- Architecture: Agents generate declarative A2UI messages that are validated against an allowed component catalog; the SwiftUI engine then renders these validated structures, ensuring no arbitrary code execution occurs on the client side.
- Core Components: The
genui-kitpackage handles A2UI state, bindings, and the SwiftUI renderer, whilegenui-components-swiftprovides the shared design system and component catalogs used for validation and rendering. - Backend & Protocol: The
genui-agent-protocoldefines the versioned client-backend contract, supported by a TypeScript-based agent runtime (genui-agent-runtime-ts) and a Cloudflare deployment (genui-cloudflare-agent) for durable sessions. - Development Environment: The workspace uses a Makefile for bootstrapping and building, requiring Swift 6, Node.js 20+, and Xcode supporting iOS/macOS 26; it includes an offline
Playgroundcomponent for testing fixtures without network dependencies.
Industry Insight
- Developers should prioritize declarative UI protocols over direct code generation for AI agents to mitigate security vulnerabilities and ensure consistent rendering across different platforms.
- The separation of concerns between agent logic, protocol definition, and client-side rendering allows for greater flexibility in swapping out AI providers or updating UI components independently.
- As generative UI matures, standards like A2UI will likely become critical infrastructure, enabling interoperability between disparate AI services and native application frameworks.
Disclaimer: The above content is generated by AI and is for reference only.