Skip to content

feat(native): Swift views take core's names in the Astryx module - #8299

Merged
cixzhang merged 3 commits into
mainfrom
native/swift-core-names
Oct 24, 2026
Merged

cixzhang merged 3 commits into
mainfrom
native/swift-core-names

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What changes for people

An iOS developer writes import Astryx, then Button(label: "Save", variant: .primary) { save() } or Text("Hello"): Astryx's views have core's component names, and that one import brings SwiftUI and the generated contracts with it. In a file that also imports SwiftUI, Astryx.Button and SwiftUI.Button name each one.

What this does

Applies the Swift component API spec's naming rule (packages/native/specs/swift/library/component-api.md, A1, A1a, A1b):

  • The six views are renamed to core's names: AstryxButton → Button, AstryxText → Text, AstryxHeading → Heading, AstryxCard → Card, AstryxTextInput → TextInput, AstryxBanner → Banner, each in Sources/Astryx/<Name>/<Name>.swift.
  • The Astryx module re-exports SwiftUI and AstryxNative (Exports.swift), so import Astryx is the only import an app file needs.
  • Code inside the module writes SwiftUI.Button and SwiftUI.Text wherever it means the system view.
  • The Login template imports only Astryx; tests that also import SwiftUI write Astryx.<Name>.
  • packages/native/specs/README.md and the component API Current state name the files <Name>.swift and the views by core's names.
  • A new NamesTests.swift imports only Astryx and checks that Text, Button, and Card are Astryx's views, SwiftUI.Text and SwiftUI.Button are the system ones, and the generated contracts come with the import.

The views keep their current parameters. Moving each view onto its generated <Name>Props, typed token reads, and href drawing a Link follow in separate pull requests, component by component.

Captures (AST-093 FR5)

Not measured: the six views in light, dark, and the largest text size. Nothing draws differently here (names and imports only; the views' bodies are unchanged), and the author cannot draw SwiftUI where it works: Swift Package Manager's sandbox blocks swift test, and an ImageRenderer probe is stopped. The native screenshot lane that draws every state on the iOS Simulator is still open (#8027); once it is on main, the captures come from it.

Accessibility tree: not measured, for the same reason; the views' accessibility code is unchanged.

Testing

  • swiftc -typecheck of both modules, the tests (including the new names test), and the templates passes against the macOS 14 SDK; the Swift tests run in CI on the iOS Simulator.

Every changed file is under packages/native/.

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 24, 2026 10:30pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 24, 2026, 11:02 PM UTC

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested before approval. The rename and the single import Astryx hold up, and both Swift packages build and pass their tests on macOS and the iOS Simulator. Please add the AST-093 FR5 captures section to the description (the six views in light, dark and the largest text size, or a not-measured report with the reason) and update packages/native/specs/README.md, which still names component files Astryx<Name>.swift. The SwiftUI and AstryxNative re-export has no current spec yet and is recorded as a spec gap under AST-093 FR6, not as a blocker.

[Automated review]


To add a component, create `Sources/Astryx/<Name>/Astryx<Name>.swift` with
core's prop names, read its tokens from `astryx`, and add tests under
To add a component, create `Sources/Astryx/<Name>/<Name>.swift` declaring

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/native/specs/README.md:17 still draws each component file as Astryx<Name>.swift, and the Current state of packages/native/specs/swift/library/component-api.md still calls the views prefixed; updating both here keeps the native guides in agreement with this recipe.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested before approval. The rename and the single import Astryx hold up, the earlier requests are addressed, and both Swift packages build and pass their tests on macOS and the iOS Simulator. Two small fixes remain:

  • Add a line to the "Captures (AST-093 FR5)" section reporting the rendered accessibility tree as not measured, which AST-093's Current-state impact asks of every native change until an app-hosted iOS test target exists.
  • The new Current state line in packages/native/specs/swift/library/component-api.md says only Button keeps hand-written parameters, but all six views still do (and Banner has no generated contract yet).

[Automated review]

(SwiftUI views with core's names, `Button`, `Text`, and so on, re-exporting
SwiftUI and the contracts) and the `AstryxNative` product (generated contract
types, unprefixed: `ButtonProps`, `ButtonVariant`).
- Button keeps hand-written parameters until it moves onto `ButtonProps`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All six views keep hand-written parameters, not only Button: Text, Heading, Card and TextInput still take hand-written enums and shapes although their <Name>Props are generated, and Banner has no generated contract yet (AST-093's Current-state impact lists all six). Suggested wording: "The six views keep hand-written parameters until each moves onto its generated <Name>Props; Banner has no generated contract yet."

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ready to approve: the six Swift views now take core's names, import Astryx brings SwiftUI and the generated contracts, and both Swift packages build and pass their tests on macOS and the iOS Simulator. The earlier requests are addressed, with the captures and the rendered accessibility tree reported as not measured and the component API's Current state naming all six hand-written views. The SwiftUI and AstryxNative re-export has no current spec yet, so it is recorded as a spec gap under AST-093 FR6 rather than a blocker. Approval can follow once the CI jobs still running on this head finish green.

[Automated review]

This branch was successfully deployed

1 active deployment
Preview — 7f2363ab Deployed Oct 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant