SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.
Detected risks:
The swiftui-patterns skill provides a comprehensive guide to modern SwiftUI architecture and best practices for building declarative, high-performance user interfaces on iOS and macOS. It focuses on effective state management using SwiftUI property wrappers like @State, @Binding, and the newer @Observable, ensuring that views only re-render when necessary. Additionally, it covers environment value injection, dependency management, and structuring of view models to support clean, maintainable codebases. By following these patterns, developers can build scalable, efficient, and predictable SwiftUI applications while avoiding common pitfalls related to state updates and view invalidation.
Key features include detailed guidance on selecting appropriate property wrappers based on use case, leveraging @Observable for property-level reactivity, composing views into small, focused subviews to minimize unnecessary re-renders, and using ViewModifiers for reusable styling. Navigation is addressed with type-safe NavigationStack patterns, supporting programmatic routing and safe path manipulation. The skill also emphasizes performance optimization for lists and complex layouts, encouraging patterns that reduce view invalidation and improve responsiveness. Environment injection techniques are highlighted as a replacement for @EnvironmentObject to enhance modularity and testability.
This skill is ideal for SwiftUI developers looking to adopt modern UI patterns, iOS and macOS engineers optimizing app performance, and teams seeking to standardize state management and view composition strategies. It is particularly useful for those working on dynamic interfaces, large-scale applications with complex data flows, or projects requiring robust, type-safe navigation and reusable styling components. The guidance supports developers at various levels, from those integrating basic @State management to experts optimizing large SwiftUI codebases.
For view-local value types like toggles, you should use @State, which manages state within the view itself.
Yes, @Observable is recommended as it tracks property-level changes, allowing SwiftUI to re-render only the views that read the changed properties.
Yes, it provides guidance on using NavigationStack with NavigationPath for programmatic, type-safe routing.
Yes, the skill covers SwiftUI patterns applicable to both iOS and macOS platforms.
While @Environment supports dependency injection, it is best used for shared values rather than mutable state to ensure predictable data flow.
Quick Setup:
.claude/skills/Repository
affaan-m/everything-claude-code