Feedback/DSSkeleton

DSSkeleton

feedback
since v1.0

Pulsing 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

PropTypeDefaultDescription
widthCGFloat?nilFixed width. nil = full width.
heightreqCGFloatโ€”Shape height.
radiusCGFloatDSRadius.smallCorner 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
}

Related Components