Skip to content

Complete SwiftUI Implementation of v0.10 Basic Catalog#729

Draft
sunnypurewal wants to merge 182 commits intogoogle:mainfrom
sunnypurewal:main
Draft

Complete SwiftUI Implementation of v0.10 Basic Catalog#729
sunnypurewal wants to merge 182 commits intogoogle:mainfrom
sunnypurewal:main

Conversation

@sunnypurewal
Copy link

@sunnypurewal sunnypurewal commented Feb 26, 2026

The breadth of the v0.9 spec requires this PR to be massive as it is meant to be a complete implementation. If there are best practices that you'd like me to follow to make the review of this PR manageable please let me know.

Description

This PR implements a SwiftUI renderer of the basic catalog components and functions defined in v0.9

The sample app demonstrates the union of the A2UI elements, the data model, and the rendered SwiftUI for each component. The basic catalog functions are also demonstrated on user input.

All Files Changed are new files. No files in the google:main branch have been edited.
I added a CHANGELOG as per the checklist.

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

PROMPT: So this is a fresh clone of the A2UI repo, and I've implemented a Swift renderer that I want to contribute back to the project open-source. However, there's no git history because I copied the code from another repo. Can we analyze the code and create 5-10 git commits that document the changes. What info do you need to accomplish this?
PROMPT: do it
PROMPT: fix the build error when running swift test
…e test structure

PROMPT: can you work on fixing the the tests in this folder `swift test` to run them
PROMPT: is @Sources/A2UI/DataStore/A2UIDataStore.swift flush() required? it's never called

PROMPT: yes but is flush() called anywhere in Sources()

PROMPT: yes please write those tests

PROMPT: add both tests you mentioend earlier
… FormatDateTests

PROMPT: @Sources/A2UI/Models/ComponentType.swift  and @Tests/A2UITests/Models/ComponentTypeTests.swift need updating. There's a number of lines of code not being tested and it should be easy to test just doing codable swaps and inits

PROMPT: currently formatDate() in A2UIStandardFunctions uses the device's locale and timezone. In the tests, this results in different behaviour depending on the runtime environment. How can I handle dates in @Tests/A2UITests/Functions/Formatting/FormatDateTests.swift so that the tests work in all timezones?
PROMPT: In a recent change I removed :CaseIterable, Identifiable from all the enums, please add back

PROMPT: use id
PROMPT: please update all XCTest to Swift Testing
PROMPT: can you confirm that just printing it in the sample app is not good enough?
…handling

PROMPT: this customFunctionHandelr is not required
PROMPT: ite seems to me that it's a bad idea to include os_log in the library because it will spam the conosle of apps that people make with it

PROMPT: i don't want to include any 3rd party libraries in my package

PROMPT: but i don't want ANY logging when the package is used in another app

PROMPT: yes
PROMPT: can we also remove all instances of the keyword internal since this is the default visibility in swift
PROMPT: there are 168 commits made to this fork of the google/A2UI repo on github. Please create a CHANGELOG.md file the summarizes what was done. This fulfills documentation requirements for the PR. In short
Implements a SwiftUI renderer of the basic catalog components and functions defined in v0.9
Sample client app demonstrating the JSON<->UI relationship
but research the commit messages and git log for more details to put in the CHANGELOG. do not go overboard, I think this file was meant to exist already in the repo but I can't find it. Or this file is meant to be created on every PR as a summary of the PR

PROMPT: just to be clear, it's 168 commits

PROMPT: the title _and_ the body of each commit message is relevant

PROMPT: in terms of versioning, this is an _initial_ implementation of the spec in Swift. So let's just stay constant at 0.9 in this document
PROMPT: please find all references to the "0.10" version (of a2ui schema) in the Swift code and replace it with 0.9

PROMPT: please only edit *.swift files
…tion samples

PROMPT: the formatDate function in the sample app demonstration is failing @/var/folders/gr/k70llq3x35g87p_5mpc37z480000gn/T/simulator_screenshot_272D28A2-7164-4F33-9B76-45432A58B9FD.png

PROMPT: go
PROMPT: map each of these enum cases to an SF Symbol

enum ComponentCategory: String, CaseIterable {
	case layout = "Layout"
	case content = "Content"
	case input = "Input"
	case navigation = "Navigation"
	case decoration = "Decoration"
	case functions = "Functions"
}
PROMPT: do the same for this

enum ComponentType: String {
	case row = "Row"
	case column = "Column"
	case list = "List"
	case text = "Text"
	case image = "Image"
	case icon = "Icon"
	case video = "Video"
	case audioPlayer = "AudioPlayer"
	case button = "Button"
	case textField = "TextField"
	case checkbox = "CheckBox"
	case slider = "Slider"
	case dateTimeInput = "DateTimeInput"
	case choicePicker = "ChoicePicker"
	case tabs = "Tabs"
	case modal = "Modal"
	case divider = "Divider"
}
Updated formatting and section headers in README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant