Feedback/DSSkeleton
DSSkeleton
feedbackPulsing placeholder shapes that mimic the layout of content while it loads.
iOS 17+macOS 14+
Purpose
Reduce perceived loading time and layout shift. Use instead of a spinner whenever the layout is known.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| width | CGFloat? | nil | Fixed width. nil = full width. |
| heightreq | CGFloat | โ | Shape height. |
| radius | CGFloat | DSRadius.small | Corner radius. |
Examples
Card skeleton
Placeholder matching a content card layout.
swift
DSSkeletonCard() // pre-built card placeholder
// Or custom layout:
VStack(alignment: .leading, spacing: DSSpacing.sm) {
DSSkeleton(height: 16, radius: DSRadius.small) // title
DSSkeleton(width: 120, height: 12, radius: DSRadius.small) // subtitle
}