Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive and well-architected SwiftUI renderer for A2UI. The use of modern SwiftUI features like @Observable and the Layout protocol is excellent, and the extensive test suite provides great coverage. I've identified a few critical issues related to error handling where errors are silently ignored, which could make debugging difficult. I've also suggested refactoring a particularly complex function to improve its maintainability and efficiency. Addressing these points will significantly enhance the robustness of the new renderer. Additionally, please note that the PR description template should be filled out as per the repository's contributing guidelines.
renderers/swiftui/Sources/A2UISwiftUI/Models/ComponentTypes.swift
Outdated
Show resolved
Hide resolved
renderers/swiftui/Sources/A2UISwiftUI/Processing/SurfaceViewModel.swift
Outdated
Show resolved
Hide resolved
f3e04e6 to
73f0426
Compare
0193e32 to
1a2ea60
Compare
71513e2 to
ed589dc
Compare
28fda9e to
0ba163b
Compare
fe53e0e to
02a0ac3
Compare
a631c11 to
dd7c657
Compare
…mpliance across all platforms
dd7c657 to
29ed936
Compare
|
Hi @jacobsimionato @ava-cassiopeia — this PR implements a complete v0.8 SwiftUI renderer (18 components, data binding, JSONL streaming, multi-surface, demo app with live A2A agent). All automated review Two questions:
|
|
Howdy, thanks for your contributions! We'll try to review this fully when we can, though due to the size of the PR it will take us a moment. In the meantime, to your questions -
Where you have this is fine for now, but we're actively in the process of standing up a GitHub org to move this repo into. Once we do that, we'll probably want this to live in its own repo there. So, depending on whether this gets merged or that org is set up is first, we'll either split it out or just have the repo moved there wholesale.
To my knowledge, we're still working on v0.9's spec, so as soon as we lock that in v0.9 support for Swift would be fantastic. I'd hold off for now though, as it might end up having wasted work. |
8015aa0 to
c8147ce
Compare
|
Hi @BBC6BAE9, thank you for the substantial SwiftUI renderer work — 100 files is serious effort! 🙏 We're moving community renderers to an ecosystem model. Rather than maintaining renderers for every platform in this monorepo, we want community renderers in their own repos where authors have full ownership and release velocity. Recommended path forward:
Note: there's another SwiftUI effort in PR #729 by @sunnypurewal — you two might benefit from collaborating or at least coordinating to avoid duplicate work. See the full ecosystem at a2ui.org/ecosystem/renderers. We'd love to see a SwiftUI renderer listed there! |
|
NOTE: it is possible we could "graduate" from a community renderer to the core A2UI repo, with maintenance guarantees and conformance testing. We are currently not staffed to be able to make headway on this, right now and I want to unblock you. Please self host and link in docs. |
|
@zeroasterisk Thanks for the guidance. Renderer repo: https://github.com/BBC6BAE9/a2ui-swiftui |
Description
Native SwiftUI renderer for the A2UI protocol, enabling all Apple platforms to render agent-generated UI from A2UI JSON payloads into native SwiftUI views.
Resolves #680.
Spec v0.8 Compliance
This renderer fully implements the A2UI spec v0.8, covering all protocol messages and component types:
beginRendering,surfaceUpdate,dataModelUpdate,deleteSurface(+ v0.9createSurface/updateComponentsforward-compat)/items/0/name), bracket/dot normalization, template rendering, literal seedingformatString,formatNumber,formatCurrency,formatDate,pluralize,openUrl,required,email,regex,length,numeric,and,or,notbeginRendering.stylesparsed intoA2UIStyle, overridable per-component via SwiftUI Environment18 Native Components — Platform-Adaptive via Apple HIG
All 18 standard components render using native SwiftUI controls only — no hardcoded spacing, colors, or corner radii. Each component adapts its appearance per platform rather than forcing a single mobile-style design across all devices.
Font+AccessibilityHeadingLevelAsyncImageusageHint-driven sizing (avatar→circle clip, header→full-width)Layout.borderedProminent/.borderedTextField/SecureField/TextEditortextFieldType-driven (number→.decimalPad, longText→TextEditor, obscured→SecureField)Toggle(.automaticstyle)SwiftUI.SliderProgressViewDatePickerNavigationLinklistPicker(.segmented)/ScrollViewbuttons.wheel.sheet+NavigationStack.presentationDetentson iOS/macOS; plain sheet on watchOS/tvOSAVPlayerViewControllerAVPlayerHStack/VStackdistributionlayout (spaceBetween/spaceEvenly/center/end)ScrollView+LazyVStack/LazyHStackdirectionswitches axisSwiftUI.Divider()Platforms:
iOS 17+·macOS 14+·tvOS 17+·watchOS 10+·visionOS 1+Every platform-specific decision is documented in
COMPONENT_DECISIONS.md.Custom Component Support
Third-party components can be registered via
CustomComponentRegistryand rendered inline alongside standard components:The demo app includes a Rizzcharts example with custom
Chart(Swift Charts doughnut) andGoogleMap(MapKit) components.Demo Application
The demo app (
samples/client/swiftui/) includes 10 pages covering both static JSON demos and live agent connections. Each demo page includes an info inspector explaining what it demonstrates, and action-triggering pages display a Resolved Action log showing the resolved context payload.genui demo: https://github.com/BBC6BAE9/genui
Static Demos (no agent required)
formatDatecatalog function in action contextA2UIStyleoverriding default text/button/card appearanceChart+GoogleMapregistered viaCustomComponentRegistrysurfaceUpdatemessages arriving over timeLive Agent Demos (connects to repo's
samples/agent/adk/agents)component_gallery:10005contact_lookup:10003restaurant_finder:10002rizzcharts:10004The live agent pages include A2A Client with SSE streaming and agent card discovery (
/.well-known/agent-card.json).Unit Tests — 106 tests across 7 files
DataBindingTestsMessageDecodingTestsPrimitivesTestsMultipleChoiceLogicTestsCatalogFunctionTestsTextFieldValidationTestsValidationTests11 JSON fixtures in
Tests/A2UITests/TestData/for integration-level decoding tests.Project Structure
All files are new additions. No existing files on
google:mainwere modified.Pre-launch Checklist
If you need help, consider asking for advice on the discussion board.