layout/DSSection
DSSection
layoutNamed content group with an optional header, footer note, and inset background.
iOS 17+macOS 14+watchOS 10+tvOS 17+visionOS 1+
Purpose
Organise forms and settings into logical named groups.
Interactive Reference
Live showroom
Need the full visual surface?
Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().
Best for exploring:
variants, states, categories, and real app examples in one place.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | String? | nil | Section heading. |
| description | String? | nil | Supporting text under the heading. |
| trailing | AnyView? | nil | View aligned with the heading (e.g. a "See all" link). |
| contentreq | @ViewBuilder () -> Content | โ | Section content. |
Examples
Settings sections
Two titled sections.
swift
DSSection(title: "Notifications", description: "Alerts only apply when the app is in the background.") {
DSToggle("Push notifications", isOn: $pushEnabled)
DSToggle("Email digest", isOn: $emailEnabled)
}
DSSection(title: "Projects", trailing: AnyView(DSLink("See all") { navigate(.projects) })) {
DSListRow(title: "Website redesign") { open(.website) }
}