SwiftUI Best Practices, straight from Apple's Xcode 27 Agent Skill
Article Summary
Antoine van der Lee reverse-engineered Apple's official SwiftUI Agent Skill from Xcode 27 and found something surprising: it's laser-focused on performance, but leaves out huge chunks of everyday SwiftUI development.
Apple shipped its first SwiftUI Agent Skill with Xcode 27, designed to guide AI coding assistants toward best practices. The skill uses a compact structure with a main router file and nine reference documents covering specific topics like data flow, animations, and ForEach identity. Van der Lee analyzed what Apple prioritized and what they left out.
Key Takeaways
- Apple's skill treats views as invalidation units, optimizing what re-renders
- Factor sections into separate View types, not computed properties for performance
- Never use .if view modifiers: they destroy identity and break animations
- Make @Observable property types Equatable to skip redundant invalidations
- Apple's skill omits accessibility, navigation, macOS patterns, and Swift Charts entirely
Apple's SwiftUI Agent Skill excels at teaching the invalidation model and correctness patterns, but skips accessibility, navigation, layout, and platform-specific features that real apps need.
About This Article
Antoine van der Lee found that Apple's SwiftUI Agent Skill was missing nine important areas. These gaps included accessibility, navigation patterns, layout guidance, scrolling, macOS support, Swift Charts, image handling, previews, and performance tooling analysis.
Van der Lee took Apple's nine-reference-file skill and combined it with his own more detailed SwiftUI Expert Skill. The result was version 4.0.0, which brings both approaches together while keeping token costs down through separate reference files.
Developers can now install the unified SwiftUI Expert Skill using the 'npx skills add' command. They get both Apple's best practices for avoiding invalid code and coverage of real-world features like accessibility, navigation, and platform-specific patterns all in one agent skill.