Skip to content

spec(native): Swift component API takes the generated contract in SwiftUI's shape - #8035

Merged
cixzhang merged 1 commit into
mainfrom
spec/native-swift-component-api
Oct 24, 2026
Merged

cixzhang merged 1 commit into
mainfrom
spec/native-swift-component-api

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Exact decision needed

How a SwiftUI view in @astryxdesign/native is named and exposes its component's generated contract: core names in a module named Astryx, the parameter list for each platform, the two initializers, SwiftUI shapes for actions and content slots, the contract's types for words and values, and what a view never offers. Approved by the owner; this description matches the current head.

Existing authority searched

  • spec:AST-082 (current): core and platform contracts (FR3), portable props and typed slots (FR4), platform-scoped Swift bindings generated from the same contract (FR5), base props (FR7), naming (FR8), visuals in the theme rather than props (DEC-2).
  • The AST-082 FR4 amendment that lets a platform accept a wider form for a content slot (spec(AST-082): open string sets, portable projections, and typed slot forms #8070): A4's open content slots rely on it.
  • spec:AST-093 (current): parameters named and typed as the generated contract (FR5). A5 follows it; SwiftUI spellings that convert to contract types are OQ1.
  • The Swift typed slots spec (packages/native/specs/swift/library/slots.md) sets the slot forms A4 uses.

Decision

  • A1 Core names, unprefixed, in a library product and module named Astryx (import Astryx, then Button, Text, Theme, ButtonProps); Astryx re-exports SwiftUI and the generated contracts; generated wire types keep their names; no type named Astryx.
  • A1a Button(…) and Astryx.Button(…) are the same view. A file that imports only Astryx gets Astryx's type for an unqualified shared name. A file that also imports SwiftUI writes Astryx.Button / SwiftUI.Button: there Swift rejects an unqualified shared name in a type position; a string-literal call both initializers accept resolves to Astryx's view (String ranks above LocalizedStringKey), and a call only one initializer accepts compiles against that one, so for calls the qualifier is the rule.
  • A1b Package code qualifies the 19 shared names with their own module: 16 from SwiftUI, Calendar and Timer from Foundation, Selector from ObjectiveC.
  • A1c View modifiers keep the prefix: .astryxTheme(_:).
  • A2 Every core prop and every platform prop of <Name>Props for the platform being built (ios, macos, such as Selector's menuStyle) is a parameter with the same name, type, and default; content slots, which <Name>Props leaves out, are @ViewBuilder parameters; no Swift-only enums or props.
  • A3 A props initializer and a labeled SwiftUI-style initializer build the same props; the labeled one takes content slots as @ViewBuilder closures and the props one as their generated node types, as slots.md says; body reads only those.
  • A4 Main word first and unlabeled; parameters without defaults before those with defaults, except a required action, which comes last as a trailing closure; content slots are open @ViewBuilder closures, never AnyView; text slots are String fields, icon slots IconName fields.
  • A5 Words and values take the contract's types (AST-093 FR5); LocalizedStringResource and Binding spellings are OQ1, an AST-093 FR5 amendment decided outside packages/native/.
  • A6 The contract's own visual props stay; no visual parameter beyond the contract and no public style protocols.
  • A7 id and isHidden map once, on the contract's base target.
  • A8 One-sentence doc comment on every public declaration.

Rejected alternatives

None recorded in the spec.

Claim scope and non-goals

Tokens and theming, accessibility semantics, Dynamic Type, and per-component behavior are separate specs. Renaming the existing views and bringing them onto the generated contract is a later pull request.

Landing order

Lands after the AST-082 FR4 amendment (#8070), which A4's open content slots rely on, and after the typed slots spec (#8037), whose slots.md A3 and A4 cite.

Evidence and implementation relationship

One file: packages/native/specs/swift/library/component-api.md.

Writing rubric results

  • R1 narration: none; every requirement states what a view does.
  • R2 research in the record: none; references are the platform pages followed.
  • R3 evidence naming a change: none.
  • R4 rejected alternatives: none.
  • R5 pull request or issue references remaining: none in the record.
  • R6 ruled open questions still listing options: none; OQ1 and OQ2 are unanswered and each carries one recommendation.

Scope

  • Specification only; no implementation.
  • Every changed file is under packages/native/.
  • Public text contains no internal context.

Name resolution evidence

Checked with swiftc (Swift 6, macOS 14 SDK) on two modules: a contracts module re-exported by a views module named Astryx that declares Button and Text and re-exports SwiftUI.

  • A file with only import Astryx: let t: Text = Text("x") and let b: Button = Button("x") {} compile and are Astryx.Text / Astryx.Button; SwiftUI.Toggle(…) resolves.
  • A file with import SwiftUI and import Astryx: let t: Text = Text("x") fails with 'Text' is ambiguous for type lookup in this context; Astryx.Text and SwiftUI.Text both resolve; let a = Text("Hello") and let b = Button("Save") {} compile and are Astryx.Text / Astryx.Button.
  • Names visible under import SwiftUI that core also uses, from a compile probe over all 173 core component names: Button, Calendar, ContextMenu, Divider, Grid, HStack, Layout, Link, List, Section, Selector, Slider, Stepper, Tab, Table, TableRow, Text, Timer, VStack.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@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 9:01am UTC

Request Review

@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, 9:26 AM 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

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec f98b552

@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.

Requesting changes: the direction is owner-approved, but the record states Swift behavior that does not hold and conflicts with two current specs that it leaves unamended.

  • A1a: in a file that imports both SwiftUI and Astryx, an unqualified Button or Text is ambiguous (ambiguous use of 'Button', 'Text' is ambiguous for type lookup), so the rule, its acceptance check and the docs guidance need restating, or the prefix kept.
  • A6 forbids the color, padding and elevation parameters that the generated contracts carry and AST-082 FR3 keeps; limit it to visual parameters outside the contract.
  • A4's Binding and A5's LocalizedStringResource spelling depart from AST-093 FR5 ("named and typed as the generated contract") and fail A2's own check; amend FR5 or narrow A2.
  • Current state describes the unmerged swift-ios-1 package rather than main's AstryxNative, and A1b's list should requalify Foundation's Timer and cover Calendar and Selector.

The corrected head will need a fresh /approve-spec.

[Automated review]

Comment on lines +29 to +35
- **A1a — Two spellings, one view.** `Button(…)` and the module-qualified
`Astryx.Button(…)` name the same view. In a file that imports both SwiftUI
and `Astryx`, the unqualified name means Astryx's view, because a module's
own types take precedence over those of a module it imports. The system
view is written `SwiftUI.Button`. Documentation and examples write
`Astryx.Button` wherever SwiftUI's view of the same name appears in the same
file.

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.

In a file that imports both SwiftUI and Astryx, Swift does not prefer Astryx's Button: a module's own types win only inside that module. A two-module compile probe gives ambiguous use of 'Button' for a call both initializers accept and 'Text' is ambiguous for type lookup in this context in a type position, with or without @_exported import SwiftUI. Only a file that imports Astryx alone, with SwiftUI re-exported, gets the bare name. Suggest restating A1a that way and updating the A1a check (line 84) and the Summary, or keeping the prefix.

Comment on lines +39 to +42
names that SwiftUI also declares today are `Button`, `ContextMenu`,
`Divider`, `Grid`, `HStack`, `Layout`, `Link`, `List`, `Section`, `Slider`,
`Stepper`, `Tab`, `Table`, `TableRow`, `Text`, `Timer`, and `VStack`; a new
component whose name SwiftUI declares joins this list.

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.

Timer is Foundation's type, not SwiftUI's. If the list means names visible under import SwiftUI, which re-exports Foundation, it also needs Foundation's Calendar and Objective-C's Selector, both core components (Selector already has a generated Swift contract). Qualify each with its own module: Foundation.Timer, Foundation.Calendar, ObjectiveC.Selector.

Comment on lines +60 to +68
- A value prop paired with its change callback in the core contract is a
`Binding` (`value:`).
- A typed slot (AST-082 FR4) is a generic `@ViewBuilder` parameter
constrained to the slot's kind, never `AnyView`.
- Parameters with defaults come after those without.
- **A5 — Words have a localizable spelling.** Each word parameter has a
`LocalizedStringResource` spelling, looked up in the caller's bundle when it
is shown, beside the contract's `String` spelling, shown as given. Both set
the same prop.

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.

A4's value: Binding (Switch, TextInput and Selector pair value with onChange) and A5's LocalizedStringResource spelling are parameters that are not props of the generated <Name>Props, so they fail A2's own check (line 87) and depart from AST-093 FR5 ("parameters named and typed as the generated contract"), which stays unamended. Either amend AST-093 FR5 and narrow A2 to the props initializer, or drop these spellings until FR5 allows them.

Comment on lines +69 to +72
- **A6 — No styling parameters.** A view has no color, font, padding, corner, or
shadow parameter and no public `*Style` protocol. Visuals come from the
theme (AST-082 DEC-2). Layout around the component stays with the caller's
own modifiers.

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.

As written, this forbids color (Text, Heading), padding and its variants (Card, HStack, VStack) and elevation (Button, Card): core props that A2 makes parameters and that AST-082 FR3 says a platform never removes. The check on line 92 already targets SwiftUI Color, Font, CGFloat padding and *Style; suggest limiting the text to visual parameters the contract lacks.

Comment on lines +98 to +108
- The SwiftUI views are named with an `Astryx` prefix (`AstryxButton`,
`AstryxText`), the module is `AstryxCore`, and the theme types are
`AstryxTheme` and `AstryxTokens`; the theme generator spec uses the same
prefixed theme names.
- The SwiftUI views for Banner, Button, Card, Heading, Text, and TextInput
declare their own enums (for example `AstryxButtonVariant`) and do not
import the generated contract types.
- The Button view adds `icon` and `fillsWidth`, which the contract lacks, and
leaves out the contract's `elevation`, `isInterruptible`, `tooltip`, and
`href`.
- Every word parameter is a `String`.

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 describes the unmerged swift-ios-1 package (AstryxCore, AstryxButton, icon, fillsWidth), not main. On main the only Swift package is packages/native/apple, whose product and module are AstryxNative, with generated contracts and no SwiftUI views. Please describe main and name the AstryxNative to Astryx rename that A1 implies.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b70015d

@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.

Requesting changes: the direction is owner-approved and the earlier points are fixed, but A4's slot rule conflicts with the rest of the record. A4 makes every typed slot a @ViewBuilder generic, yet the generated <Name>Props leaves content slots out (Card, HStack, VStack), so A3's "body reads only that value" and the A2/A5 checks ("no public parameter outside the generated <Name>Props") cannot hold, while text slots (Text, Heading, Badge, Divider) are String under A5 and AST-093 FR5. Scoping A4 to content slots, as the typed-slots draft in #8037 does, and adjusting A3 and the two checks resolves it; the corrected revision will need a fresh /approve-spec.

  • Smaller: A2 names only ios platform props, while the macOS SelectorProps also carries a macos menuStyle.
  • Smaller: in a file that imports both modules, a call that fits only one initializer compiles without error, so A1a's "fails loudly" holds for type positions only.

[Automated review]

Comment on lines +66 to +67
- A typed slot (AST-082 FR4) is a generic `@ViewBuilder` parameter
constrained to the slot's kind, never `AnyView`.

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.

A text slot is a String field of the generated <Name>Props (Text and Heading children, Badge and Divider label), which A2, A5 and AST-093 FR5 keep, while a content slot is left out of <Name>Props (packages/native/src/contract/generateSwift.ts:132-137). So the builder this bullet requires fails the A2/A5 checks (lines 94 and 98) for Card, HStack and VStack, and their children are outside the value A3's body reads (line 61). Suggest scoping this bullet to content slots, saying text slots are words under A5, and adjusting A3 and the two checks for content builders.

Comment on lines +52 to +53
- **A2 — The contract is the parameter list.** Every core prop and `ios`
platform prop of the generated `<Name>Props` is a parameter of the view with

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.

The package also builds for macOS (Package.swift, .macOS(.v14)), and Selector declares menuStyle under macos (packages/native/src/components/Selector.ts:37-42). Suggest "every core prop and every platform prop of the generated <Name>Props for the platform being built".

Comment on lines +35 to +37
- In a file that also imports SwiftUI directly, or another module that
declares the same name, an unqualified shared name is ambiguous to Swift,
so the file writes `Astryx.Button` and `SwiftUI.Button`.

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.

Type positions and calls that both initializers accept are ambiguous, but a call that only one module's initializer accepts compiles against that module without an error, so for calls the qualifier is a convention rather than something the compiler enforces. The A1a check (line 91) could add such a call.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e022f2f

@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.

Requesting changes: the earlier slot conflict is fixed, but this revision's A4 now lets a content slot accept any SwiftUI view, while current AST-082 FR4 gives non-React platforms only a typed slot of named Astryx components and keeps free-form content to the web and React-running contracts. The allowance A4 relies on is the FR4 amendment proposed in #8070, and the slots.md it cites exists only in #8037. Either narrow A4's builder to the Astryx components the core slot names and drop the path (a new commit needs a fresh /approve-spec), or hold this revision until #8070 and #8037 land and have it reviewed again.

  • Smaller: A4's "a required action comes last" (line 73) and "parameters with defaults come after those without" (line 79) give two orders for a component with a required callback.
  • Smaller: the PR description's Decision list still describes A4 with a Binding and builders for every typed slot.

[Automated review]

Comment on lines +74 to +76
- A `content` slot (AST-082 FR4) is a generic `@ViewBuilder` closure
parameter that accepts any view, as
`packages/native/specs/swift/library/slots.md` says, never `AnyView`. A

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 content slot accepts any SwiftUI view, but current AST-082 FR4 gives non-React platform contracts only a typed slot (named Astryx components) and keeps free-form content to the web and React-running contracts. The wider-form allowance is the FR4 amendment in #8070, and slots.md exists only in #8037. Suggest limiting the builder to the Astryx components the core slot names, as "constrained to the slot's kind" did, and dropping the path, or merging after #8070 and #8037 land.

`packages/native/specs/swift/library/slots.md` says, never `AnyView`. A
`text` slot is words, a `String` field of `<Name>Props` (A5), and an `icon`
slot is an `IconName` field.
- Parameters with defaults come after those without.

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.

With line 73 this gives two orders for a component with a required callback and a defaulted parameter: the required action has no default yet comes last. Suggest stating the trailing action as the exception.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 0156851

@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.

Requesting changes: A4 still lets a content slot accept any SwiftUI view, which current AST-082 FR4 allows only for the web and React-running contracts, and the amendment it relies on is still open in #8070. Land #8070 first and ask for a fresh review, or narrow A4's builder to the Astryx components the core slot names; any new commit needs a fresh /approve-spec.

  • A4 cites packages/native/specs/swift/library/slots.md, which only #8037 adds, so add #8037 to the landing order or drop the path.
  • A3 gives the props initializer the same content builders as the labeled one, while slots.md in #8037 has it take the generated node type; please align the two records.

[Automated review]

Comment on lines +73 to +76
- A `content` slot (AST-082 FR4, with its amendment that lets a platform
accept a wider form for a content slot) is a generic `@ViewBuilder`
closure parameter that accepts any view, as
`packages/native/specs/swift/library/slots.md` says, never `AnyView`. A

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 content slot accepts any SwiftUI view, but current AST-082 FR4 keeps free-form content to the web contract and React-running platform contracts and gives every other contract a typed slot of named Astryx components. The amendment named here is only proposed in #8070, and slots.md exists only in #8037, so on today's main this sentence contradicts FR4 and points at a missing file. Land #8070 (and #8037) first, or narrow the builder to the Astryx components the core slot names and drop the path.

Comment on lines +65 to +69
- **A3 — Two ways in, one meaning.** The view has an initializer that takes
`<Name>Props`, for generated and wire-driven callers, and a SwiftUI-style
initializer with labeled parameters. Both build the same `<Name>Props` and
take the same content-slot builders, and the view's `body` reads only that
value and those builders.

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.

A3, and the A2 compile check on line 107, give the props initializer the same content-slot builders as the labeled initializer, while slots.md S3 in #8037 says "The props initializer takes the slot as the matching generated node type." Since A4 defers to slots.md for the slot form, please let one record own the props initializer's content parameter and align the other.

Comment on lines +37 to +41
`SwiftUI.Button`. There, Swift rejects an unqualified shared name in a type
position, and in a call that both modules' initializers accept, as
ambiguous; a call that only one module's initializer accepts compiles
against that module, so for such calls the qualifier is this rule, not a
compiler error.

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.

Worth testing before relying on: Swift reports this ambiguity only when the two initializers tie in overload ranking, and it ranks a string literal's default type String above LocalizedStringKey, so with A5's String words a plain Text("Saved") in a file importing both modules should resolve to Astryx.Text without an error. Adding a call like Text("x") to the A1a compile check (line 103) would settle which way it goes.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 822cd49

@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.

Requesting changes: A4 still lets a content slot accept any SwiftUI view, which current AST-082 FR4 allows only for the web and React-running contracts, and the amendment it relies on is still open in #8070. Land #8070 first and ask for a fresh review, or narrow A4's builder to the Astryx components the core slot names; any new commit needs a fresh /approve-spec.

  • This record lands after #8037, but #8037 says it lands after this record and cites its OQ1, so land the two together or drop one of the cross-references.
  • The A1a check let a: Astryx.Text = Text("x") compiles whichever initializer ranks first; check let a = Text("x") and its type in a separate statement instead.

[Automated review]

initializer with labeled parameters. Both build the same `<Name>Props`. The
labeled initializer takes each content slot as a `@ViewBuilder` closure, and
the props initializer takes it as the slot's generated node type, as
`packages/native/specs/swift/library/slots.md` says; the view's `body` reads

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.

slots.md exists only in #8037, and #8037's description says it lands after this pull request (its S1 also cites this record's OQ1), while this description says this record lands after #8037. Followed as written, neither can land first. Suggest landing the two records together, or dropping one direction of the cross-reference (for example, stating the props initializer's node type and IconName here) and making the landing orders agree.

| Requirement | Check |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| A1 | The package manifest names the library product and module `Astryx`; a source check finds no type named `Astryx` in it. |
| A1a | A compile test with two app files: one importing only `Astryx` checks that `let a: Button = Button("x") {}` is `Astryx.Button` and `SwiftUI.Button("x") {}` is SwiftUI's; one importing SwiftUI and `Astryx` checks that `Astryx.Button` and `SwiftUI.Button` both resolve, that `let t: Text` does not compile there (ambiguous in a type position), that `let a: Astryx.Text = Text("x")` compiles there (a string-literal call both initializers accept resolves to Astryx's), and that a call only Astryx's initializer accepts, `Button("x", variant: .primary) {}`, compiles as `Astryx.Button`. |

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.

let a: Astryx.Text = Text("x") gives the call a contextual type that only Astryx's initializer satisfies, so it compiles whichever initializer would rank first without the annotation and cannot show the ranking the parenthesis states. Suggest let a = Text("x") followed by a separate let _: Astryx.Text = a.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 35e55fc

@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.

Requesting changes: A4 still lets a content slot accept any SwiftUI view, which current AST-082 FR4 allows only for the web and React-running contracts, and the amendment it relies on is still open in #8070. Land #8070, then #8037 (which adds the cited slots.md and IconName), and ask for a fresh review, or narrow A4's builder to the Astryx components the core slot names; any new commit needs a fresh /approve-spec.

  • A2 still calls a content slot a @ViewBuilder parameter of every initializer, and its source check rejects the <Name>Props parameter that A3's props initializer takes; please align both with A3.
  • A8's doc comment that "names the core prop it maps to" and the A3 check's "equal <Name>Props" cannot be met as worded, since some public declarations map to no prop and the generated props hold closures and are not Equatable.

[Automated review]

Comment on lines +62 to +63
same default. A `content` slot, which `<Name>Props` leaves out, is a
`@ViewBuilder` parameter of the view's initializers instead (A4). The view

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.

A3 (lines 70–72) gives the props initializer each content slot as its generated node type, so this sentence holds only for the labeled initializer. Suggest "a @ViewBuilder parameter of the labeled initializer (A3)". The A2 source check (line 110) also needs to allow the <Name>Props parameter A3's props initializer takes, which is neither a prop of <Name>Props nor a content slot.

Comment on lines +99 to +100
- **A8 — Every public declaration has a one-sentence doc comment** that names
the core prop it maps to.

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.

The view type, body, the props initializer and <Name>Props itself map to no single core prop, so this cannot be met as worded. Suggest "names the core prop it maps to, where it maps to one".

| A1c | A source check finds no public `View` extension member without the `astryx` prefix. |
| A2 | A source check fails when a components file declares an `enum` with the same cases as a generated enum, or a public parameter that is neither a prop of the generated `<Name>Props` nor a content slot of the contract. |
| A2 | A compile test builds every view from its generated `<Name>Props` with every prop set, plus each content slot's generated node type, and through the labeled initializer with a builder for each content slot, on iOS and on macOS. |
| A3 | A test shows the labeled initializer and the props initializer produce equal `<Name>Props` for the same arguments. |

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.

The generated props are not Equatable and hold closures (ButtonProps.onClick, SelectorProps.onChange), so "equal <Name>Props" is undefined for them. Suggest naming what the test compares, such as every non-callback field and each callback reaching the same action.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 50e537e

@cixzhang
cixzhang force-pushed the spec/native-swift-component-api branch from 50e537e to dd9d796 Compare October 24, 2026 07:56
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec dd9d796

@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.

Requesting changes: the record conforms to current AST-082 and AST-093 and carries an engineering owner's /approve-spec for this revision, but A3 and A4 cite packages/native/specs/swift/library/slots.md, which is not on main or in this branch yet. Because this branch's README row conflicts with the one #8037 adds, this revision can only merge before #8037, which would leave both citations pointing at a missing file. Please land #8037 first and rebase (rows in order: accessibility.md, component-api.md, slots.md, theme-generator.md), or drop the two citations since A3 and A4 already state the slot forms, then request review of the new head.

[Automated review]

Comment on lines +73 to +82
generated node type, as `packages/native/specs/swift/library/slots.md` says,
and both build the view from the same `<Name>Props` values; the view's `body`
reads only those values and slots.
- **A4 — SwiftUI shapes for SwiftUI concepts.**
- The component's main word comes first and unlabeled, as in `Button` and
`Text`.
- A `content` slot (AST-082 FR4, with its amendment that lets a platform
accept a wider form for a content slot) is a generic `@ViewBuilder`
closure parameter that accepts any view, as
`packages/native/specs/swift/library/slots.md` says, never `AnyView`. A

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.

slots.md is not on main or in this branch; it exists only in #8037. Once #8037 lands, this branch's README row conflicts with its slots.md row, so this revision can merge unchanged only before #8037, leaving both citations pointing at a missing file. Land #8037 and rebase, or drop the two citations, since A3 and A4 already state the forms.

@cixzhang
cixzhang force-pushed the spec/native-swift-component-api branch from dd9d796 to 1579770 Compare October 24, 2026 08:53
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 1579770

@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.

Recommending approval: the record conforms to current AST-082 and AST-093, an engineering owner's /approve-spec covers this revision, and the slots.md citations now resolve on main. Two optional wording fixes are left inline: A3's check could say whether slots.md S3's per-slot convenience initializers count, and A4 can cite AST-082 FR4 directly instead of "with its amendment". The theme generator spec still names AstryxTheme and AstryxTokens, so landing #8038 next keeps the two records consistent.

[Automated review]

- **A4 — SwiftUI shapes for SwiftUI concepts.**
- The component's main word comes first and unlabeled, as in `Button` and
`Text`.
- A `content` slot (AST-082 FR4, with its amendment that lets a platform

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.

Non-blocking: AST-082 FR4 itself now carries the wider-form sentence, so "with its amendment" reads as change history (writing rubric R1). Suggest: "A content slot (AST-082 FR4, which lets a platform accept a wider form for a content slot) …".

| A1c | A source check finds no public `View` extension member without the `astryx` prefix. |
| A2 | A source check fails when a components file declares an `enum` with the same cases as a generated enum, or a public parameter that is neither a prop of the generated `<Name>Props`, the `<Name>Props` value itself, nor a content slot of the contract. |
| A2 | A compile test builds every view from its generated `<Name>Props` with every prop set, plus each content slot's generated node type, and through the labeled initializer with a builder for each content slot, on iOS and on macOS. |
| A3 | A test builds a view through each initializer with the same arguments and finds every `<Name>Props` field the same in both, comparing callbacks by invoking them. |

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.

Non-blocking: slots.md S3 also gives a view one convenience initializer per Astryx component its content slot names (for example startContent: AvatarProps). Consider saying whether those must build the same <Name>Props too, for example "through each initializer, the slot convenience initializers included".

@cixzhang
cixzhang merged commit 0c00688 into main Oct 24, 2026
69 checks passed
@github-actions
github-actions Bot deleted the spec/native-swift-component-api branch October 25, 2026 06:20

This branch was successfully deployed

1 active deployment
Preview — 1579770c 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