1. How swift-docc-render consumes this
An xcodeRequirement reference is one entry in a render node's top-level
references dictionary. Grepping src/components/ and
src/views/ for the literal string xcodeRequirement turns up no entry in
ContentNode.vue's generic block/inline dispatch table — this kind is never routed
through that switch. Instead it is consumed directly, by prop, along a single fixed path used only for
the tutorial-page hero: Tutorial/Hero.vue → Tutorial/HeroMetadata.vue.
A tutorial's hero/intro render section carries an
xcodeRequirement field that is itself just a plain string — the reference's
identifier, not the resolved object. Hero.vue receives that identifier as a prop
and resolves it against the shared references map (via the referencesProvider
mixin) with a computed property:
xcodeRequirementData() {
return this.references[this.xcodeRequirement];
},
(Hero.vue#L154-L156; the xcodeRequirement prop declaration is at
Hero.vue#L125-L128.) The resolved object is then passed down to the
HeroMetadata child (locally aliased Metadata) as its own
xcodeRequirement prop:
<Metadata
:projectFilesUrl="projectFilesUrl"
:estimatedTimeInMinutes="estimatedTimeInMinutes"
:xcodeRequirement="xcodeRequirementData"
class="metadata"
/>
(Hero.vue#L54-L59.) HeroMetadata.vue is where the reference is finally
rendered, as one of up to three metadata "chips" alongside estimated reading time and a project-files
download link:
<div class="item" v-if="xcodeRequirement">
<XcodeIcon class="item-large-icon icon-inline" />
<div class="content bottom">
<span v-if="isTargetIDE">{{ xcodeRequirement.title }}</span>
<a v-else :href="xcodeRequirement.url" class="content-link">
{{ xcodeRequirement.title }}
<InlineChevronRightIcon class="icon-inline small-icon xcode-icon" />
</a>
</div>
</div>
(HeroMetadata.vue#L52-L61; prop declaration at
HeroMetadata.vue#L87-L91.) The whole chip is gated on the reference resolving at all
(v-if="xcodeRequirement"); if the identifier didn't resolve in references, the
chip and its XcodeIcon simply don't render. Presentation then branches on the injected
isTargetIDE flag (HeroMetadata.vue#L79, ultimately sourced from
process.env.VUE_APP_TARGET === 'ide' in App.vue): when the page is being
displayed inside Xcode's own documentation viewer, only the plain title text is shown (no
link, since Xcode already has that Xcode version); on the public web, title is wrapped in an
<a href="{url}"> pointing at the download URL, with a trailing chevron icon.
The reference is also threaded through Article.vue's generic section-prop plumbing
(Article.vue#L125-L161), which destructures xcodeRequirement off of any
hero-kind section and forwards it into Hero's props — this is plumbing,
not a second consumption site; the actual rendering logic is entirely in HeroMetadata.vue
above.
See also: The references map — how this and every other reference-dictionary lookup works across kinds.
2. Example JSON and rendered mockup
No fixture containing a full "type": "xcodeRequirement" reference object was found.
Tests/DocCArchiveTests/Fixtures/'s two .doccarchive archives only contain the
substring xcodeRequirement inside minified, bundled DocC-render JS assets (e.g.
js/topic.c7f55345.js), not in any data/documentation/*.json RenderNode —
neither example project's tutorials declare an @XcodeRequirement. In
swift-docc's own test suite, RenderSectionTests.swift and
RenderNodeDataExtractorTests.swift only exercise the hero section's plain-string
xcodeRequirement field (e.g. "xcodeRequirement" : "Xcode 10 beta") or assert
against decoded Swift model properties (xcodeRequirementReference.title,
xcodeRequirementReference.url.absoluteString in
SemaToRenderNodeTests.swift) rather than embedding the literal resolved-reference JSON
object as it would appear in a render node's references map. The example below is
hand-written from the XcodeRequirementRenderReference schema (Section 3) and from the field
values asserted in SemaToRenderNodeTests.swift (title: "Xcode X.Y Beta Z",
url: "https://www.example.com/download").
{
"sections": [
{
"kind": "hero",
"title": "Building a Great App",
"xcodeRequirement": "Xcode X.Y Beta Z",
"estimatedTimeInMinutes": 20
}
],
"references": {
"Xcode X.Y Beta Z": {
"type": "xcodeRequirement",
"identifier": "Xcode X.Y Beta Z",
"title": "Xcode X.Y Beta Z",
"url": "https://www.example.com/download"
}
}
}
mockup: rendered as the second metadata "chip" in the tutorial hero's bottom row, next to the
estimated-time chip. On the public web (isTargetIDE false) the title is a clickable link to
the download URL with a trailing chevron; inside Xcode's own doc viewer it would be plain,
non-clickable text.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/XcodeRequirementRenderReference (lines 1718–1741), cross-checked
against Components.Schemas.XcodeRequirementRenderReference in
Sources/DocCArchive/generated/Types.swift (lines 2434–2472).
XcodeRequirementRenderReference is one arm of the AnyRenderReference
discriminated union (matched by its type field) that makes up the entries of a render
node's top-level references dictionary.
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
type |
string | yes | "xcodeRequirement" (single-value enum) |
Generated as _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { case xcodeRequirement = "xcodeRequirement" }, coded under key "type". In swift-docc's Swift model this is RenderReferenceType.xcodeRequirement (RenderReference.swift:29). |
identifier |
string | yes | — | The dictionary key under which this reference is stored in the render node's references map. In swift-docc's translator this identifier is derived directly from the authored title string, not a separately-generated ID (RenderNodeTranslator.swift:190-193: RenderReferenceIdentifier(requirement.title)). |
title |
string | yes | — | Presentation-friendly label for the required Xcode version, e.g. "Xcode 13". Displayed verbatim by HeroMetadata.vue regardless of isTargetIDE. |
url |
string | yes | — | Download URL for the required Xcode version. Typed as Foundation.URL in swift-docc's XcodeRequirementReference struct but downgraded to a plain JSON string (no format: uri) in the OpenAPI spec and generated as Swift.String in Types.swift. Used only as an href when isTargetIDE is false; otherwise unused. |
DocCArchive's own transform layer does not act on this kind at all today: MyHTMLTransformer
and MyMarkdownTransformer (Sources/DocCArchive/DocCArchive.swift) are still
stub placeholders — the former returns a hardcoded HTML comment and the latter an empty string
— and neither walks a render node's references dictionary at all, so a parsed
Components.Schemas.XcodeRequirementRenderReference value has no conversion path written for
it yet.
4. HTML/CSS mapping in DocC-Render output
The resolved reference renders as one div.item inside HeroMetadata.vue's root
div.metadata (a flex row shared with the estimated-time and project-download chips). Markup,
web target (isTargetIDE false): div.item > svg.item-large-icon.icon-inline
(the XcodeIcon component) + div.content.bottom >
a.content-link[href="{url}"] containing the title text plus a trailing
svg.icon-inline.small-icon.xcode-icon (InlineChevronRightIcon). In the Xcode/IDE
target (isTargetIDE true) the anchor is replaced by a plain span with just the
title text and no chevron icon.
Relevant SCSS: all of it lives in HeroMetadata.vue's own scoped <style
lang="scss"> block, which imports docc-render/styles/_core.scss. .item
uses the font-styles(metadata-item) mixin, lays out as a column with
justify-content: flex-end, and gets a border-right: 1px solid
dark-color(figure-gray) separator between chips (removed on .item:last-of-type and on
.item:first-of-type's left padding). .content-link is a flex row that keeps the
title text and chevron icon aligned on one baseline. The anchor's color comes from the CSS custom
property chain a { color: var(--colors-link, var(--color-tutorials-overview-link)); }, and
the icon is sized via .item-large-icon (height: 2.3rem, 1.5rem at
the small breakpoint) and .small-icon.xcode-icon (width/height:
0.8em). The whole hero (including this metadata row) sits inside Tutorial/Hero.vue's
.hero.dark block, which forces the dark color-scheme custom-property set via
@include color-vars-dark regardless of the user's OS-level light/dark preference, so the
metadata chip's colors (dark-color(figure-gray), the link color variable) are always resolved
against that forced-dark palette.
5. Modern CSS-only alternative
NOT APPLICABLE
Current JS/Vue behavior in play: HeroMetadata.vue has no client-side state at all for this
kind. Its only piece of dynamic logic is a one-time, build-time-injected boolean
(isTargetIDE, sourced from process.env.VUE_APP_TARGET at build time in
App.vue) that picks between two static template branches
(v-if="isTargetIDE" plain <span> vs. v-else
<a>) — there is no click handler, no toggling, no runtime interactivity to
replace. Everything else (the icon, the title text, the href, the border/flex layout) is static markup
driven directly by the resolved reference's title/url fields.
Because the IDE/web branch is decided once at build time and never changes in response to user
interaction, there is no interactive behavior here for a native CSS mechanism (<details>,
:checked, :target, the Popover API, <dialog>,
:has(), container queries, anchor positioning, view transitions) to hold in its place. The
verdict is therefore not applicable: this kind's rendering is a stateless, build-time-conditional link or
label, not a runtime UI widget.