Preview Data Generator
Generate sample data and a multi-variant #Preview matrix for SwiftUI views, ...
Install
npx skills add rshankras/claude-code-apple-skills --skill preview-data-generator -g -a claude-code -y- Repository
- rshankras/claude-code-apple-skills846
- Category
- Design
- Updated
- 3mo ago
- License
- MIT
- Context cost
- Mediumabout 2,197 tokens
- Runs scripts
- No, instructions only
What it does
Generate sample data and a multi-variant #Preview matrix for SwiftUI views, empty/loading/error/loaded states, light/dark, Dynamic Type, locales/RTL, and devices. Use when the user says "add previews", "sample data for previews", "preview my view in different states", "preview data", "prototype this UI", or wants realistic Xcode canvas data without hand-rolling it.
Preview Data Generator
Generates two tightly-coupled things for a SwiftUI view:
- Sample data tuned for the Xcode canvas, realistic instances plus the visual edge cases that break layouts (empty, one item, huge list, long/overflowing strings, missing images, error and loading states).
- A
#Previewmatrix, the variant blocks you'd otherwise hand-write to prototype and QA a view across light/dark, Dynamic Type, locale/RTL, device sizes, and data states.
This is the design-time counterpart to testing/test-data-factory (which makes fixtures for the test suite). Where a factory already exists, this skill reuses Model.fixture() instead of inventing parallel data.
When This Skill Activates
Use this skill when the user:
- Wants sample/mock data for Xcode previews ("what do I put in the preview?")
- Wants to preview a view in multiple states (empty / loading / error / loaded)
- Is prototyping UI and wants light/dark, Dynamic Type, RTL, or device variants
- Says "add previews", "preview matrix", "preview this in dark mode + large text"
- Has a SwiftData
@Modeland needs an in-memory seeded container for previews - Is on Xcode 16 / iOS 18 and wants shared, cached preview data via
PreviewModifier
Just need fixtures for unit tests? Use testing/test-data-factory instead.
Want screenshot regression tests? Pair this with testing/snapshot-test-setup, the same data + variant matrix feeds snapshot tests.
Reference Files
Load both before generating:
| File | Purpose |
|---|---|
| preview-data-patterns.md | Sample-data design, the edge-case catalog, SwiftData in-memory seeding, PreviewModifier (iOS 18), @Previewable, reusing test-data-factory |
| preview-matrix.md | The variant axes, preview traits:, .environment overrides, deployment-target fallbacks (#Preview vs PreviewProvider), data-state previews |
Pre-Generation Checks
Generators are context-aware. Before writing code, detect:


