1. How swift-docc-render consumes this
resources is the kind discriminator for ResourcesRenderSection,
a top-level section of a Tutorials Overview ("Table of Contents") page — the page produced from
a @Tutorials directive's technology-overview file when it contains an authored
@Resources block. The outer page component,
TutorialsOverview.vue,
declares a small SectionKind map (hero, resources,
volume) used to validate the incoming sections prop and to split out the
hero section; every non-hero section (in practice, every volume and
resources section) is handed to
LearningPath.vue
as otherSections.
LearningPath.vue is the actual dispatch site for this kind. It partitions
sections into volumes (kind === 'volume') and
otherSections, then renders every remaining section — currently only
resources in practice, since hero/volume are the map's only
other keys — through a generic componentFor(section) / propsFor(section)
lookup table:
const SectionKind = { resources: 'resources', volume: 'volume' };
...
componentFor: ({ kind }) => ({
[SectionKind.resources]: Resources,
[SectionKind.volume]: Volume,
}[kind]),
propsFor: ({ chapters, content, image, kind, name, tiles }) => ({
[SectionKind.resources]: { content, tiles },
[SectionKind.volume]: { chapters, content, image, name },
}[kind]),
(LearningPath.vue lines 43–104,
via a <component :is="componentFor(section)" v-bind="propsFor(section)"> in the
template.) So a resources section is rendered by the
Resources component, receiving only its content and tiles
fields as props — note that kind itself is not forwarded past this dispatch point.
The whole template of
TutorialsOverview/Resources.vue
is:
<section class="resources" id="resources" tabindex="-1">
<VolumeName :name="$t('sections.resources')" :content="content" />
<TileGroup :tiles="tiles" />
</section>
It reuses the same
VolumeName.vue
component that a named VolumeRenderSection uses for its header band, but passes it the
localized string $t('sections.resources') ("Resources" in en-US) as the
name instead of an authored title — so every resources section always shows a
"Resources" heading, with the section's own content array rendered underneath it as the
section's abstract. The tiles themselves are delegated to
ResourcesTileGroup.vue
(registered locally as TileGroup), which lays out one
ResourcesTile.vue
per entry in tiles in a CSS grid whose column/row template depends on
tiles.length (count-1 through count-6 modifier classes).
Each tile renders an identifier-specific icon (documentation/downloads/forums/sampleCode/videos, via
a lookup table keyed on identifier), a title, its content
through the shared ContentNode.vue, and an optional call-to-action link built from
action resolved through DestinationDataProvider.
Resources.vue also mixes in
onIntersectViewport,
overriding the default intersectionRootMargin to intersectionMargins.topOneThird
('-30% 0% -70% 0%', i.e. triggering when the section crosses the top third of the
viewport rather than dead center as Volume.vue does). When triggered, it calls
this.store.setActiveSidebarLink('Resources') and
this.store.setActiveVolume(null) against the injected
TutorialsOverviewStore,
clearing any "active volume" highlight in the side nav. That side nav,
TutorialsNavigation.vue,
renders a plain TutorialsNavigationLink (not an expandable menu, unlike named volumes)
for each section it recognizes as isResources(section) (kind === 'resources'),
labelled with the same $t('sections.resources') string.
See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.
2. Example JSON and rendered mockup
No literal JSON fixture containing "kind": "resources" was found. DocCArchive's own test
fixtures (ExampleDocs.doccarchive, SampleLibrary.doccarchive) contain only
documentation-topic pages, not tutorials, so the string "resources" only appears there
inside minified render-side JS bundles (e.g. js/tutorials-overview.9144a669.js), not as
page data. swift-docc's test suite exercises ResourcesRenderSection in
Tests/SwiftDocCTests/Model/SemaToRenderNodeTests.swift only via Swift-literal
XCTAssert* calls against a decoded object (asserting tile titles "Documentation",
"Sample Code", "Xcode and SDKs" among resources.tiles), not an embedded JSON literal, so
there is no ready-made JSON string to lift. The example below is hand-written to match the vendored
schema exactly (required kind + tiles, each tile requiring
identifier/title/content), with tile titles modeled on the
names actually asserted in that test.
{
"kind": "resources",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Explore more resources for learning about TechnologyX." }
]
}
],
"tiles": [
{
"identifier": "documentation",
"title": "Documentation",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Browse the full API reference." }
]
},
{
"type": "unorderedList",
"items": [
{ "content": [ { "type": "paragraph", "inlineContent": [ { "type": "reference", "identifier": "doc://org.swift.docc.example/tutorials/Test-Bundle/TestTutorial", "isActive": true } ] } ] }
]
}
]
},
{
"identifier": "sampleCode",
"title": "Sample Code",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Browse and download sample code projects." }
]
}
],
"action": {
"type": "reference",
"identifier": "doc://org.swift.docc.example/tutorials/Test-Bundle/TestTutorial2",
"isActive": true
}
},
{
"identifier": "downloads",
"title": "Xcode and SDKs",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Get Xcode and the latest SDKs." }
]
}
],
"media": "xcode-download.png"
}
]
}
Explore more resources for learning about TechnologyX.
Documentation
Browse the full API reference.
Sample Code
Browse and download sample code projects.
View more ›
Xcode and SDKs
Get Xcode and the latest SDKs.
mockup: a "Resources" name band (shared VolumeName component, fed the localized
section title instead of an authored one) followed by a ResourcesTileGroup grid, one
tile per entry in tiles, laid out with a column count that depends on
tiles.length.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/ResourcesRenderSection (lines 360–406), cross-checked against
the generated Components.Schemas.ResourcesRenderSection struct in
Sources/DocCArchive/generated/Types.swift (lines 3465–3546). Compare against
swift-docc's own ResourcesRenderSection.swift Swift model (in
Sources/SwiftDocC/Model/Rendering/Tutorials Overview/Sections/ResourcesRenderSection.swift),
which additionally declares a section-level content: [RenderBlockContent] property
(default []) that is not present in the vendored JSON schema's
ResourcesRenderSection object — the schema only lists kind and
tiles as properties, so the generated Swift struct in this repository has no
content field at all, even though swift-docc-render's dispatch table
(LearningPath.vue's propsFor, shown above) explicitly reads and forwards a
content field from each section. This is a genuine authority gap between the vendored
schema and the actual wire shape swift-docc emits and swift-docc-render expects; treat the schema's
omission of top-level content as a likely gap in the vendored spec file rather than
evidence that real archives never carry it.
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
kind |
string | yes | "resources" |
Generated as a one-case KindPayload enum. In swift-docc's Swift model this defaults to
.resources via public var kind: RenderSectionKind = .resources. |
tiles |
array of tile objects | yes | — | One entry per RenderTile; forwarded to Resources.vue's
ResourcesTileGroup, which grids them by count and renders each through
ResourcesTile.vue. |
tiles[].identifier |
string | yes | "featured", "documentation", "sampleCode",
"downloads", "videos", "forums" |
Selects both the tile's icon in ResourcesTile.vue (documentation/downloads/forums/
sampleCode/videos each map to a distinct icon component; featured has no icon mapping in
that lookup table) and, on the authoring side, is produced by which Tile subdirective
(@Documentation, @SampleCode, @Downloads, @Videos,
@Forums) was written inside @Resources. |
tiles[].title |
string | yes | — | Rendered as div.title in ResourcesTile.vue. |
tiles[].content |
array of RenderBlockContent |
yes | — | Required at the tile level (unlike the section-level content discussed above); an
empty array is schema-valid. Rendered through ContentNode.vue inside the tile. |
tiles[].action |
RenderInlineContent |
no | — | Typically a reference inline-content node; resolved via
DestinationDataProvider into a url/title pair and rendered as a
"View more"-style link with a trailing chevron icon. Absent when a tile has no call-to-action link. |
tiles[].media |
string (format: reference, nullable) |
no | — | A reference-identifier string for accompanying media. Declared in the schema but not read by any
prop in ResourcesTileGroup.vue's propsFor (which forwards only
action, content, identifier, title) or by
ResourcesTile.vue's own props — so as of the pinned commit, media is
present on the wire but appears to be dead data for this particular tile presentation. |
content (section-level) |
array of RenderBlockContent |
no (swift-docc Swift model only; absent from the vendored JSON schema object entirely) | default [] in swift-docc's Swift struct |
See the authority-gap note above. swift-docc-render's LearningPath.vue
propsFor does forward a content field from the raw section object into
Resources.vue's content prop, which is what supplies the abstract shown
under the "Resources" heading. |
4. HTML/CSS mapping in DocC-Render output
Rendered DOM shape, assembled from LearningPath.vue, Resources.vue,
ResourcesTileGroup.vue, and ResourcesTile.vue:
div.learning-path>div.main-container>div.primary-content-container>div.content-sections-container— the shared outer scaffolding fromLearningPath.vue(same as forvolumesections); each direct child gets a.content-sectionclass from thev-forloop, giving rounded corners and inter-section spacing.section.resources.content-section#resources(tabindex="-1") — the root element fromResources.vue's template. The literalid="resources"makes this section a same-page anchor target (e.g. for a#resourcesdeep link), andtabindex="-1"lets it receive programmatic focus without being in the normal tab order.div.volume-name(from the reusedVolumeName.vue) — containsh2.name(the localized "Resources" label) and theContentNodeoutput for the section'scontent.div.tile-group.count-N(fromResourcesTileGroup.vue,N=tiles.length, 1–6 have dedicated grid rules) — a CSS grid container.div.tile× N (fromResourcesTile.vue) — each containing an optionaldiv.icon(SVG icon component keyed onidentifier),div.title, the tile'sContentNodeoutput, and an optionalReference.linkbuilt fromaction.
SCSS lives in each component's own <style scoped lang="scss"> block, all importing
docc-render/styles/_core.scss: ResourcesTileGroup.vue (the
count-1–count-6 grid-template rules and their small/medium breakpoint
overrides) and ResourcesTile.vue (per-tile background, padding, icon sizing, and link
styling). Resources.vue itself only styles bare .title/.content
selectors (largely superseded since the markup now delegates those to VolumeName.vue).
Key CSS custom properties consumed:
--color-tutorials-overview-fill-secondaryonResourcesTile.vue's.tile(falls back todark-color(fill-secondary)) — the same panel color used by named-volume chapter tiles and theVolumeNameband.--color-tutorials-overview-content-alton.tile's text color and on.content.--color-tutorials-overview-iconon each tile's SVG icon fill, with--color-tutorials-overview-content-altused for any icon stroke.--colors-link(falling back to--color-tutorials-overview-link) on the tile's call-to-actiona/.content alinks.
These custom properties are defined per color scheme under
src/styles/core/colors/ (e.g. --color-tutorials-overview-fill-secondary and
its siblings starting around line 187 of _light.scss, mirrored for dark mode elsewhere in
the same directory).
DocCArchive transform status: MyHTMLTransformer and MyMarkdownTransformer
in Sources/DocCArchive/DocCArchive.swift are still stub placeholders (the HTML transformer
returns a hardcoded <!-- what? --> comment and the Markdown transformer returns an
empty string) — there is no kind-specific handling for resources/
ResourcesRenderSection today.
5. Modern CSS-only alternative
NOT APPLICABLE
Current behavior in play: ResourcesTileGroup.vue selects a grid layout purely from a
static, server/build-time-known prop (tiles.length, exposed as a
count-1…count-6 class computed once from props.tiles);
there is no click handler, no toggled visibility, and no client-side state transition anywhere in
Resources.vue, ResourcesTileGroup.vue, or ResourcesTile.vue.
The one piece of runtime behavior tied to this kind, the onIntersectViewport mixin on
Resources.vue, only writes to the shared TutorialsOverviewStore
(setActiveSidebarLink('Resources') / setActiveVolume(null)) to update a
side-nav highlight elsewhere on the page as the user scrolls — it does not gate or toggle any
part of the resources section's own rendering, and the side nav's reaction to that store value is
already covered by the discussion of TutorialsNavigation.vue on the volume
kind's page. Within the scope of this section kind specifically, there is no interactive
show/hide, expand/collapse, or tabbed state to replace: the tile count determines a fixed grid
template via a plain reactive class binding, which is already exactly what CSS (a grid-template-columns
rule keyed off a class or, natively, a container query) does today, not something JavaScript is doing
that CSS could take over from a stateful, interaction-driven mechanism. So the verdict here is
"not applicable" because this kind's own rendering is stateless with respect to user interaction, not
because a suitable native mechanism is missing.