swift-data-flow

Explain SwiftUI data flow and state management property wrappers.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/VoldemortGin/claude-skills --skill swift-data-flow
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swift-data-flow
Source: https://github.com/VoldemortGin/claude-skills/tree/main/skills/swift-data-flow
Command: npx skills add https://github.com/VoldemortGin/claude-skills --skill swift-data-flow

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill clarifies the often confusing world of SwiftUI data flow and state management, helping developers choose the right property wrapper for any situation.

Core Features & Use Cases

  • Decision Matrix: Provides a clear, visual guide for selecting the appropriate state management tool based on data ownership and access needs.
  • Modern vs. Legacy: Explains the differences and usage of @Observable (iOS 17+) versus ObservableObject patterns.
  • Property Wrapper Reference: A comprehensive table detailing each wrapper, its ownership, type, use case, and minimum iOS version.
  • Use Case: When building a complex SwiftUI view, you can consult this Skill to determine whether to use @State, @Binding, @StateObject, or @EnvironmentObject for your data.

Quick Start

Explain the difference between @StateObject and @ObservedObject in SwiftUI.

Frequently Asked Questions about swift-data-flow

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

FAQPage Schema
What is the difference between @StateObject and @ObservedObject in SwiftUI?▼

@StateObject and @ObservedObject manage reference types in SwiftUI, but @StateObject initializes and owns the object for the view's lifetime, while @ObservedObject only observes an object owned elsewhere to prevent premature destruction.

When should I use @Observable vs ObservableObject for SwiftUI state management?▼

Use @Observable for modern SwiftUI state management on iOS 17+, which simplifies data flow tracking, versus the legacy ObservableObject pattern using @Published that requires explicit property declaration for view updates.

How do I choose the right SwiftUI property wrapper for data flow?▼

Choose the right SwiftUI property wrapper for data flow by evaluating data ownership and access needs: use @State for local value types, @Binding for child view sharing, and @Environment for app-wide dependency injection.

What are common SwiftUI state management anti-patterns to avoid?▼

Common SwiftUI state management anti-patterns include misusing @ObservedObject for local object ownership instead of @StateObject, and overusing global @EnvironmentObject when localized @Binding passing would preserve better view encapsulation.

Can I use @Environment to share data across SwiftUI views without passing bindings?▼

Yes, you can use @Environment to share data across SwiftUI views without passing bindings manually, allowing parent views to inject objects that any descendant view can read directly via the environment.