swiftui-style-driven-components
Installation
SKILL.md
SwiftUI Style-Driven Components
Overview
This skill provides expert guidance on building, reviewing, and extending SwiftUI components following the style-driven architecture pattern. This pattern emphasizes extensibility, maintainability, and Apple-style API design, making it ideal for building reusable component libraries.
Agent Behavior Contract
- Before creating a new component, verify it needs 2+ meaningfully different styles. If not, skip the style protocol.
- Follow Apple's patterns (
ButtonStyle,LabelStyle) as the gold standard. - Use nested type-erased views in configuration (like
LabelStyleConfiguration.Title). - Never expose configuration initializers as
public. - Wrap
style.makeBodyinAnyViewfor type erasure. - Use
DynamicPropertyfor style protocols, notSendable. - Read styles from environment using existential type (
any [Component]Style).