SKILL

swiftui-patterns

@Observableを使用した状態管理、ビュー合成、ナビゲーション、パフォーマンス最適化、モダンなiOS/macOS UIのベストプラクティスを備えたSwiftUIアーキテクチャパターン。

Original · translation did not pass checks

Target: Mobile development. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original Japanese text

Topics in the source

  • SwiftUI パターン
  • 起動条件
  • 状態管理
  • プロパティラッパーの選択
  • @Observable ViewModel
  • ViewModelを使用するビュー
  • 環境への注入
  • ビュー合成

Appleプラットフォーム向けのモダンなSwiftUIパターン。宣言的で高性能なユーザーインターフェースを構築するために使用する。Observationフレームワーク、ビュー合成、型安全なナビゲーション、パフォーマンス最適化をカバーする。 SwiftUIビューを構築し、状態を管理する場合(@State、@Observable、@Binding) NavigationStack を使用したナビゲーションフローを設計する場合 ビューモデルとデータフローを構築する場合 リストと複雑なレイアウトのレンダリングパフォーマンスを最適化する場合 SwiftUIで環境値と依存性注入を使用する場合 最も適したシンプルなラッパーを選択する: | ラッパー | 使用場面 | |---------|----------| | @State | ビューローカルな値型(トグル、フォームフィールド、シート表示) | | @Binding | 親ビューの @State への双方向参照 | | @Observable クラス + @State | 複数のプロパティを持つ所有モデル | | @Observable クラス(ラッパーなし) | 親ビューから渡される読み取り専用参照 | | @Bindable | @Observable プロパティへの双方向バインディング | | @Environment | .environment() で注入された共有依存関係 | ObservableObject ではなく @Observable を使用する——プロパティレベルの変更を追跡するため、SwiftUIは変更されたプロパティを読み取ったビューのみを再レンダリングする: @EnvironmentObject の代わりに @Environment を使用する: ビューを小さく焦点を絞った構造体に分割する。状態が変化した場合、その状態を読み取ったサブビューのみが再レンダリングされる: NavigationStack と NavigationPath を使用して、プログラム的で型安全なルーティングを実現する: LazyVStack と LazyHStack はビューが表示される時のみ作成する: ForEach では常に安定した一意のIDを使用する——配列インデックスは避ける: body 内でI/O、ネットワーク呼び出し、重い計算を絶対に実行しない 非同期処理には .task {} を使用する——ビューが消えると自動的にキャンセルされる スクロールビューでは .sensoryFeedback() と .geometryGroup() を慎重に使用する リストでは .shadow()、.blur()、.mask() の使用を最小化する——画面外レンダリングを引き起こす bodyの計算が高コストなビューには、不要

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
docs/ja-JP/skills/swiftui-patterns/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Requirements

  • Only the author’s Skill metadata is included. Read the full instructions to check dependencies, licensing and conditions of use.

A small first task

先阅读原作者说明,再决定是否在自己的 AI 工具中使用。

Instructions for your AI tool

Author documentation is not live verification by this site. Without evidence, we do not mark a resource as compatible, safe or free.

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:49.747Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.