swiftui-patterns

Apply SwiftUI architecture patterns for state, navigation, and rendering performance.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/samymity/bridge-ventures-backend --skill swiftui-patterns-samymity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-patterns
Source: https://github.com/samymity/bridge-ventures-backend/tree/main/.claude/skills/swiftui-patterns
Command: npx skills add https://github.com/samymity/bridge-ventures-backend --skill swiftui-patterns-samymity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of structuring SwiftUI code to keep state management correct, view updates efficient, and navigation maintainable as your app grows.

Core Features & Use Cases

  • State management with Observation: Choose between @State, @Binding, @Observable, @Bindable, and @Environment to minimize unnecessary re-renders while keeping data flow clear.
  • Composable view architecture: Extract subviews and use ViewModifier to reduce invalidation scope and keep styling reusable.
  • Type-safe navigation: Build navigation flows using NavigationStack with a NavigationPath-driven Router and a strongly typed Destination enum.
  • Performance best practices: Use lazy containers, stable identifiers, avoid expensive work in body, and apply Equatable for costly views.
  • Modern SwiftUI hygiene: Prefer #Preview mocks and avoid legacy patterns like ObservableObject and @EnvironmentObject in new code.

Quick Start

Ask the AI to review your SwiftUI feature and rewrite it using @Observable with property-scoped updates, an extracted subview structure, and a NavigationStack + NavigationPath type-safe router.

Frequently Asked Questions about swiftui-patterns

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

FAQPage Schema
How do I optimize SwiftUI view re-renders and avoid unnecessary invalidation?

Optimize SwiftUI view re-renders by selecting correct property wrappers like @Observable and @Bindable, extracting subviews to reduce invalidation scope, and applying Equatable for costly views to prevent unnecessary re-renders.

What is the best way to set up type-safe navigation in SwiftUI using NavigationStack?

The best way to set up type-safe SwiftUI navigation is using NavigationStack with a NavigationPath-driven Router and a strongly typed Destination enum to maintain scalable and maintainable navigation flows.

When should I use @Observable instead of ObservableObject in modern SwiftUI?

Use @Observable instead of ObservableObject in modern SwiftUI to leverage fine-grained property-scoped updates, minimize unnecessary view re-renders, and follow current hygiene standards by avoiding legacy patterns like @EnvironmentObject.

How do I implement environment-based dependency injection in SwiftUI?

Implement environment-based dependency injection in SwiftUI by passing dependencies through the environment, allowing composable view hierarchies to access shared data cleanly while keeping state management correct and updates efficient.

Why does my SwiftUI list perform poorly and how can I fix it?

Your SwiftUI list performs poorly if it lacks stable identifiers or uses non-lazy containers. Fix it by using lazy containers, ensuring stable identifiers, and avoiding expensive work inside the view body.