Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

spec(native): the slot-props convenience initializers are the same API (#8537)

Cindy Zhang1bd7e083c5cb
diff --git a/packages/native/specs/swift/library/component-api.md b/packages/native/specs/swift/library/component-api.md
index fea1b771bf..6b98283f76 100644
--- a/packages/native/specs/swift/library/component-api.md
+++ b/packages/native/specs/swift/library/component-api.md
@@ -79,9 +79,11 @@ same generated contract.
labeled one as a `@ViewBuilder` closure and the props one as the slot's
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. The two initializers are one API in two Swift
- spellings (`architecture:public-component-api` INV21): the labeled one
- builds the props the other takes.
+ reads only those values and slots. The two initializers, and the convenience
+ initializers that take a slot component's props (slots S3), are one API in
+ several Swift spellings (`architecture:public-component-api` INV21): each
+ builds the same `<Name>Props`, and a convenience initializer fills its slot
+ with the component its props describe.
- **A4 — SwiftUI shapes for SwiftUI concepts.**
- The component's main word comes first and unlabeled, as in `Button` and
`Text`.
@@ -135,7 +137,7 @@ same generated contract.
| 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. A source check finds no parameter that a view accepts and ignores; Switch's `size` exists on macOS only. |
-| 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. |
+| A3 | A test builds a view through each initializer, including a slot component's convenience initializer, with the same arguments and finds every `<Name>Props` field the same across them, comparing callbacks by invoking them; a convenience initializer's slot holds the component its props describe. |
| A4 | `AnyView` does not appear in the components module. An enabled Button with `href` is a `Link` in the view tree and reads as a link to VoiceOver; a disabled Button with `href` reads as a dimmed button; an Avatar with `href` draws the same as without it. A disabled Item with `href` reads as a dimmed link and does not open. |
| A5 | The A2 source check passes: no public parameter outside the generated `<Name>Props` and the contract's content slots. |
| A6 | A source check finds no public SwiftUI `Color`, `Font`, `CGFloat` padding, or `*Style` parameter on a component; the contract's own visual props are allowed. |