SwiftLee Jun 16, 2026

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

Critical Insight

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.

The article reveals why using collection indices as ForEach identifiers causes a specific performance cliff that most developers don't know about.

About This Article

Problem

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.

Solution

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.

Impact

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.