swiftui-coding-guidelines

Consolidate SwiftUI coding guidelines for views, state management, and navigation.

3|Updated Sep 29, 2025
One-click install
npx skills add https://github.com/xtone/ai_development_tools --skill swiftui-coding-guidelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-coding-guidelines
Source: https://github.com/xtone/ai_development_tools/tree/main/ios_development/skills/swiftui-coding-guidelines
Command: npx skills add https://github.com/xtone/ai_development_tools --skill swiftui-coding-guidelines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill consolidates core SwiftUI coding guidelines to standardize views, state management, and navigation.

Core Features & Use Cases

  • Comprehensive references covering best practices, patterns, and anti-patterns for SwiftUI development.
  • Provides structured guidance for state management, layout, navigation, and performance optimization.
  • Serves as a reusable knowledge base for teams building SwiftUI apps.

Quick Start

Use the SwiftUI guidelines as a reference when designing Views, building navigation, or implementing data flows. Start by consulting best-practices.md and patterns-*.md for guidance. Example command: "Summarize the recommended navigation pattern for a SwiftUI list with a detail view."

Frequently Asked Questions about swiftui-coding-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to manage state in SwiftUI to avoid unnecessary re-renders?

The best way to manage SwiftUI state is to enforce @StateObject for ownership and @ObservedObject for observation, avoiding unnecessary re-renders by preventing unstable identities and properly scoping state updates.

How do I implement navigation patterns for a SwiftUI List with a detail view?

Implement SwiftUI navigation by using NavigationStack to manage routing from a List to a detail view, following structured patterns that standardize view composition and avoid common navigation anti-patterns.

When should I use Lazy stacks in SwiftUI for performance optimization?

Use Lazy stacks in SwiftUI when rendering long lists or complex grids to enforce performance practices, delaying view instantiation until needed and avoiding the computational cost of loading all rows simultaneously.

What are common SwiftUI anti-patterns for view composition I should avoid?

Common SwiftUI anti-patterns include using unstable identities in lists, overusing observation properties causing redundant re-renders, and nesting complex layouts without leveraging reusable view components.

Can I use these SwiftUI coding guidelines for macOS app development?

Yes, you can use these SwiftUI coding guidelines for macOS app development, as they apply to iOS and macOS tooling across shared components like List, NavigationStack, and state management.

Why does my SwiftUI view re-render unnecessarily when passing objects?

SwiftUI views re-render unnecessarily when using unstable identities or incorrectly applying @ObservedObject instead of @StateObject for ownership, causing the view hierarchy to rebuild upon external state changes.