swiftui-ssot

SwiftUI SSOT (Single Source of Truth)

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "swiftui-ssot" with this command: npx skills add xtone/ai_development_tools/xtone-ai-development-tools-swiftui-ssot

SwiftUI SSOT (Single Source of Truth)

SwiftUIにおける状態管理とSSOT原則の包括的ガイド。

ディレクトリ構成

swiftui-ssot/ ├── SKILL.md (このファイル) └── references/ └── ssot.md

リファレンスファイル

references/ssot.md

Single Source of Truth(SSOT)の包括的ガイド:

  • SSOTの3つの柱: 唯一の情報源、導出状態、単方向データフロー

  • Property Wrapper選択フローチャート: @State/@Binding/@StateObject/@ObservedObject/@EnvironmentObject

  • パターン別ガイド:

  • 状態重複の解消

  • 導出状態(Computed Property)

  • State Lifting(状態の持ち上げ)

  • 兄弟View間通信

  • EnvironmentObjectの適切な使用

  • 違反検出方法: コードスメル、検索パターン

  • iOS 17+ @ObservableでのSSO実装

  • レビューチェックリスト

使用方法

状態設計時

  • references/ssot.md のProperty Wrapper選択フローチャートを参照

  • データの所有者を明確化

  • 導出可能な状態は持たない

状態関連の問題発生時

  • references/ssot.md の違反パターンを確認

  • 該当するパターンの解決策を適用

PRレビュー時

  • references/ssot.md のレビューチェックリストを使用

SSOT 3つの柱

  • 唯一の情報源: 各データは1箇所でのみ管理

  • 導出状態: 他の状態から計算可能なものは持たない

  • 単方向データフロー: 親→子へデータを渡し、子→親へはアクション

Property Wrapper 選択ガイド

状況 推奨

View内のローカル状態 @State

親から受け取る値(読み書き) @Binding

Viewが所有するObservableObject @StateObject

外部から注入されるObservableObject @ObservedObject

アプリ全体で共有 @EnvironmentObject

iOS 17+ @Observable

  • @Bindable

関連スキル

  • swiftui-coding-guidelines: 基本的なベストプラクティス

  • swift-ios-migration: iOS 17 @Observable移行

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

code-review

No summary provided by upstream source.

Repository SourceNeeds Review
-557
xtone
Coding

pr-triage

No summary provided by upstream source.

Repository SourceNeeds Review
-158
xtone
Coding

orchestrating-api-implementation

No summary provided by upstream source.

Repository SourceNeeds Review