@mmerterden/multi-agent-pipeline 20.37.0 → 20.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -49
- package/README.md +12 -10
- package/README.tr.md +12 -10
- package/docs/adr/0006-skills-core-external-split.md +5 -5
- package/docs/adr/0010-own-code-graph.md +6 -7
- package/docs/adr/0013-lsp-code-intelligence.md +6 -8
- package/docs/adr/0017-change-impact-from-the-graph.md +4 -5
- package/docs/adr/0018-cross-repo-links-not-a-global-graph.md +1 -1
- package/docs/adr/README.md +1 -1
- package/docs/ecosystem.md +53 -41
- package/docs/facts.json +15 -13
- package/docs/features.md +2 -2
- package/docs/recovery-guide.md +1 -1
- package/install/_dev-only-files.mjs +3 -0
- package/install/_platform-filter.mjs +1 -23
- package/install/catalog-history.json +1 -1
- package/install/claude.mjs +8 -1
- package/install/codex.mjs +0 -2
- package/install/copilot.mjs +0 -2
- package/install/templates/claude-hooks.json +47 -1
- package/manifest.json +455 -332
- package/package.json +5 -2
- package/pipeline/agents/security-auditor.md +58 -6
- package/pipeline/commands/multi-agent/build-optimize/SKILL.md +1 -2
- package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/design-check/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/graph/SKILL.md +12 -3
- package/pipeline/commands/multi-agent/manual-test/SKILL.md +12 -7
- package/pipeline/commands/multi-agent/research/SKILL.md +2 -2
- package/pipeline/commands/multi-agent/search/SKILL.md +10 -1
- package/pipeline/commands/multi-agent/security-review/SKILL.md +4 -0
- package/pipeline/commands/multi-agent/setup/SKILL.md +1 -0
- package/pipeline/commands/multi-agent/stack/SKILL.md +8 -0
- package/pipeline/commands/multi-agent/store-ready/SKILL.md +1 -1
- package/pipeline/commands/sim-test.md +34 -1
- package/pipeline/lib/context-budget.mjs +103 -0
- package/pipeline/lib/credential-inventory.sh +2 -3
- package/pipeline/lib/identifier-scan.mjs +145 -0
- package/pipeline/lib/outbound-gate.mjs +28 -1
- package/pipeline/lib/unattended-profile-check.mjs +13 -4
- package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
- package/pipeline/multi-agent-refs/analysis/redesign.md +17 -3
- package/pipeline/multi-agent-refs/analysis-template-corporate.md +8 -4
- package/pipeline/multi-agent-refs/analysis-template.md +7 -5
- package/pipeline/multi-agent-refs/audit-guide.md +20 -0
- package/pipeline/multi-agent-refs/complaint-analysis/phases.md +1 -0
- package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +1 -1
- package/pipeline/multi-agent-refs/features/code-graph.md +25 -0
- package/pipeline/multi-agent-refs/features/commit-multi-repo.md +63 -0
- package/pipeline/multi-agent-refs/features/design-conformance.md +20 -4
- package/pipeline/multi-agent-refs/features/dev-multi-repo.md +51 -0
- package/pipeline/multi-agent-refs/features/free-models.md +10 -3
- package/pipeline/multi-agent-refs/features/research.md +4 -3
- package/pipeline/multi-agent-refs/features/security-audit.md +25 -3
- package/pipeline/multi-agent-refs/features/test-gap.md +40 -0
- package/pipeline/multi-agent-refs/features/unattended-security.md +20 -0
- package/pipeline/multi-agent-refs/features/worktree-finalize.md +1 -1
- package/pipeline/multi-agent-refs/help/en.md +15 -9
- package/pipeline/multi-agent-refs/help/tr.md +15 -9
- package/pipeline/multi-agent-refs/knowledge.md +17 -0
- package/pipeline/multi-agent-refs/orchestrator/phase-3-user-test.md +12 -9
- package/pipeline/multi-agent-refs/outside-the-pipeline.md +9 -0
- package/pipeline/multi-agent-refs/phases/log-format.md +5 -0
- package/pipeline/multi-agent-refs/phases/operations.md +3 -5
- package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
- package/pipeline/multi-agent-refs/phases/phase-2-dev.md +8 -47
- package/pipeline/multi-agent-refs/phases/phase-3-review.md +21 -65
- package/pipeline/multi-agent-refs/phases/phase-4-commit.md +9 -59
- package/pipeline/multi-agent-refs/phases/phase-5-report.md +0 -31
- package/pipeline/multi-agent-refs/picker-contract.md +1 -1
- package/pipeline/multi-agent-refs/research/engine.md +2 -1
- package/pipeline/multi-agent-refs/rules.md +1 -1
- package/pipeline/multi-agent-refs/setup/free-models.md +10 -0
- package/pipeline/multi-agent-refs/store-ready/gate-3-policy.md +15 -0
- package/pipeline/multi-agent-refs/web-guide.md +2 -1
- package/pipeline/office/index.html +8 -9
- package/pipeline/office/toolkit.json +1 -1
- package/pipeline/rules/figma-pipeline.md +6 -3
- package/pipeline/rules/outside-the-pipeline.md +1 -1
- package/pipeline/schemas/learnings-ledger.schema.json +7 -2
- package/pipeline/schemas/prefs.schema.json +17 -4
- package/pipeline/schemas/reviewer-output.schema.json +113 -5
- package/pipeline/schemas/secret-patterns.json +49 -0
- package/pipeline/schemas/security-finding.schema.json +49 -5
- package/pipeline/scripts/_code-graph.mjs +3 -3
- package/pipeline/scripts/_graph-analysis.mjs +51 -0
- package/pipeline/scripts/_memory-policy.mjs +37 -7
- package/pipeline/scripts/_secret-scan.mjs +1 -1
- package/pipeline/scripts/_skill-practices.mjs +178 -0
- package/pipeline/scripts/_stack-routing.mjs +1 -0
- package/pipeline/scripts/autopilot-runner.mjs +8 -3
- package/pipeline/scripts/build-stack-plugins.mjs +8 -44
- package/pipeline/scripts/capture-resume.sh +19 -0
- package/pipeline/scripts/checkpoint-fold.sh +59 -0
- package/pipeline/scripts/file-context.mjs +306 -70
- package/pipeline/scripts/gate-ledger.mjs +1 -1
- package/pipeline/scripts/gen-skills-index.mjs +1 -1
- package/pipeline/scripts/graph-hint.mjs +197 -0
- package/pipeline/scripts/graph-hint.sh +20 -0
- package/pipeline/scripts/graph-query.mjs +306 -11
- package/pipeline/scripts/graph-report.mjs +29 -1
- package/pipeline/scripts/learnings-ledger.mjs +71 -15
- package/pipeline/scripts/note-agent-event.mjs +160 -0
- package/pipeline/scripts/note-agent-event.sh +19 -0
- package/pipeline/scripts/office-control.mjs +41 -15
- package/pipeline/scripts/offload-ref.sh +1 -1
- package/pipeline/scripts/parity-score.mjs +139 -0
- package/pipeline/scripts/pre-commit-check.sh +25 -4
- package/pipeline/scripts/pre-push-check.sh +3 -0
- package/pipeline/scripts/repo-recommend.mjs +321 -0
- package/pipeline/scripts/rework-rulings.mjs +5 -3
- package/pipeline/scripts/scan-agent-config.sh +1 -2
- package/pipeline/scripts/scope-check-gate.mjs +15 -2
- package/pipeline/scripts/security-evidence-gate.mjs +282 -0
- package/pipeline/scripts/unattended_policy.py +3 -2
- package/pipeline/scripts/user-test-handoff.sh +203 -0
- package/pipeline/scripts/validate-analysis-doc.mjs +17 -1
- package/pipeline/scripts/validate-planning.mjs +5 -3
- package/pipeline/scripts/validate-triage.mjs +2 -1
- package/pipeline/scripts/write-state.mjs +13 -4
- package/pipeline/skills/.skill-manifest.json +73 -69
- package/pipeline/skills/shared/README.md +41 -40
- package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +6 -6
- package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +1 -1
- package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +1 -1
- package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +1 -1
- package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +1 -1
- package/pipeline/skills/shared/core/multi-agent/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-build-optimize/SKILL.md +0 -1
- package/pipeline/skills/shared/core/multi-agent-complaint-analysis/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +5 -5
- package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +10 -0
- package/pipeline/skills/shared/core/multi-agent-manual-test/SKILL.md +12 -7
- package/pipeline/skills/shared/core/multi-agent-research/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent-search/SKILL.md +9 -0
- package/pipeline/skills/shared/core/multi-agent-security-review/SKILL.md +3 -2
- package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +1 -0
- package/pipeline/skills/shared/core/multi-agent-stack/SKILL.md +8 -0
- package/pipeline/skills/shared/core/multi-agent-store-ready/SKILL.md +4 -3
- package/pipeline/skills/shared/core/multi-agent-test/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-accessibility/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-dark-mode/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-dynamic-type/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-gen/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-screenshots/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-testflight-validation/SKILL.md +2 -2
- package/pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/agent-introspection-debugging/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/android-architecture/SKILL.md +1 -1
- package/pipeline/skills/shared/external/android-architecture/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-build-quality-gates/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-datastore/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-design-tokens-codegen/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/android-jetpack-compose-expert/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/android-mvi-viewmodel/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-performance/SKILL.md +1 -1
- package/pipeline/skills/shared/external/android-performance/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/android-security/SKILL.md +1 -1
- package/pipeline/skills/shared/external/android-security/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/api-patterns/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/api-security-best-practices/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/app-store-changelog/SKILL.md +65 -49
- package/pipeline/skills/shared/external/app-store-changelog/evals/evals.json +40 -0
- package/pipeline/skills/shared/external/app-store-changelog/references/release-notes-guidelines.md +64 -34
- package/pipeline/skills/shared/external/app-store-changelog/scripts/collect_release_changes.sh +21 -23
- package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +4 -1
- package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -0
- package/pipeline/skills/shared/external/architecture/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/backlog/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/ci-cd-pipelines/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/clean-code/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/compose-components/SKILL.md +1 -1
- package/pipeline/skills/shared/external/compose-components/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/compose-navigation/SKILL.md +1 -1
- package/pipeline/skills/shared/external/compose-navigation/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/compose-testing/SKILL.md +1 -1
- package/pipeline/skills/shared/external/compose-testing/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/context-compression/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/core-data/SKILL.md +1 -1
- package/pipeline/skills/shared/external/council/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/css-modern/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/css-modern/references/code-examples.md +5 -0
- package/pipeline/skills/shared/external/database-patterns/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +5 -0
- package/pipeline/skills/shared/external/debugging-strategies/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/docker-expert/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/e2e-testing/SKILL.md +21 -21
- package/pipeline/skills/shared/external/e2e-testing/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/e2e-testing/references/document-fixtures.md +5 -5
- package/pipeline/skills/shared/external/evidence-github/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/evidence-registry/SKILL.md +1 -1
- package/pipeline/skills/shared/external/evidence-registry/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/fastapi-pro/evals/evals.json +57 -0
- package/pipeline/skills/shared/external/firebase/SKILL.md +132 -54
- package/pipeline/skills/shared/external/firebase/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/firebase/references/functions-and-products.md +51 -0
- package/pipeline/skills/shared/external/firebase/references/security-rules.md +59 -0
- package/pipeline/skills/shared/external/fix-review-verdicts/evals/evals.json +57 -0
- package/pipeline/skills/shared/external/free-llm-apis/SKILL.md +70 -0
- package/pipeline/skills/shared/external/free-llm-apis/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +33 -0
- package/pipeline/skills/shared/external/github-actions-templates/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +1 -1
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/evals/evals.json +58 -0
- package/pipeline/skills/shared/external/handle-request/SKILL.md +2 -2
- package/pipeline/skills/shared/external/handle-request/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/hig-app-icons/SKILL.md +2 -2
- package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +1 -1
- package/pipeline/skills/shared/external/hig-components-content/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/hig-components-status/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/hig-components-system/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/hig-inputs/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/hig-patterns/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/hig-platforms/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/hig-technologies/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/html-semantic/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/humanizer/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/ios-coding-standard/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/ios-debugger-agent/SKILL.md +91 -52
- package/pipeline/skills/shared/external/ios-debugger-agent/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/ios-design-review/SKILL.md +12 -12
- package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +16 -16
- package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +1 -1
- package/pipeline/skills/shared/external/ios-iphone-duo/SKILL.md +0 -1
- package/pipeline/skills/shared/external/ios-module-structure/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/ios-security/SKILL.md +1 -1
- package/pipeline/skills/shared/external/ios-security/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/kotlin-coroutines-expert/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/localization-reuse-map/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/macos-menubar-tuist-app/SKILL.md +170 -74
- package/pipeline/skills/shared/external/macos-menubar-tuist-app/evals/evals.json +52 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/SKILL.md +119 -77
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Package.swift +5 -5
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/MyApp.swift +24 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/version.env +2 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/build_icon.sh +46 -39
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/compile_and_run.sh +70 -49
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/launch.sh +24 -17
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/make_appcast.sh +74 -59
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/package_app.sh +201 -170
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +50 -42
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +65 -35
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/version.env +2 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/references/packaging.md +49 -17
- package/pipeline/skills/shared/external/macos-spm-app-packaging/references/release.md +48 -23
- package/pipeline/skills/shared/external/macos-spm-app-packaging/references/scaffold.md +74 -44
- package/pipeline/skills/shared/external/monorepo-architect/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +14 -3
- package/pipeline/skills/shared/external/nextjs-app-router/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +3 -0
- package/pipeline/skills/shared/external/nodejs-backend-patterns/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/observability-engineer/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +10 -0
- package/pipeline/skills/shared/external/photos-camera-media/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/play-store-review/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/python-patterns/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/react-best-practices/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/rest-api-design/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +1 -1
- package/pipeline/skills/shared/external/retrofit-networking/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/room-database/SKILL.md +1 -1
- package/pipeline/skills/shared/external/room-database/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/scenario-gap-analysis/SKILL.md +1 -1
- package/pipeline/skills/shared/external/scenario-gap-analysis/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/search-first/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/security-review/SKILL.md +14 -3
- package/pipeline/skills/shared/external/security-review/evals/evals.json +48 -0
- package/pipeline/skills/shared/external/security-review/references/agentic-systems.md +93 -0
- package/pipeline/skills/shared/external/security-review/references/firebase-rules.md +100 -0
- package/pipeline/skills/shared/external/security-review/references/graphql.md +82 -0
- package/pipeline/skills/shared/external/security-review/references/llm-prompt-injection.md +93 -0
- package/pipeline/skills/shared/external/security-review/references/oauth-oidc.md +100 -0
- package/pipeline/skills/shared/external/security-review/references/owasp-mobile-top10-2024.md +1 -1
- package/pipeline/skills/shared/external/security-review/references/owasp-web-api-top10-2021.md +1 -1
- package/pipeline/skills/shared/external/security-review/references/supabase.md +73 -0
- package/pipeline/skills/shared/external/signal-community/SKILL.md +29 -10
- package/pipeline/skills/shared/external/signal-community/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/skill-creator/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/skill-creator/template.md +1 -3
- package/pipeline/skills/shared/external/spm-build-analysis/SKILL.md +80 -61
- package/pipeline/skills/shared/external/spm-build-analysis/evals/evals.json +56 -0
- package/pipeline/skills/shared/external/spm-build-analysis/references/build-optimization-sources.md +83 -133
- package/pipeline/skills/shared/external/spm-build-analysis/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/spm-build-analysis/references/spm-analysis-checks.md +89 -87
- package/pipeline/skills/shared/external/spm-build-analysis/scripts/check_spm_pins.py +90 -85
- package/pipeline/skills/shared/external/swift-concurrency-expert/SKILL.md +78 -69
- package/pipeline/skills/shared/external/swift-concurrency-expert/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/approachable-concurrency.md +52 -48
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/swift-6-2-concurrency.md +118 -184
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/swiftui-concurrency-tour-wwdc.md +68 -22
- package/pipeline/skills/shared/external/swift-concurrency-pro/SKILL.md +117 -94
- package/pipeline/skills/shared/external/swift-concurrency-pro/evals/evals.json +57 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/actors.md +102 -97
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/async-streams.md +36 -37
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/bridging.md +82 -34
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/bug-patterns.md +90 -52
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/cancellation.md +55 -55
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/diagnostics.md +66 -43
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/hotspots.md +39 -23
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/interop.md +66 -68
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/new-features.md +152 -131
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/structured.md +60 -57
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/testing.md +131 -118
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/unstructured.md +37 -29
- package/pipeline/skills/shared/external/swift-formatstyle/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +77 -58
- package/pipeline/skills/shared/external/swift-testing-pro/evals/evals.json +59 -0
- package/pipeline/skills/shared/external/swift-testing-pro/references/async-tests.md +139 -144
- package/pipeline/skills/shared/external/swift-testing-pro/references/core-rules.md +90 -28
- package/pipeline/skills/shared/external/swift-testing-pro/references/migrating-from-xctest.md +38 -21
- package/pipeline/skills/shared/external/swift-testing-pro/references/new-features.md +139 -156
- package/pipeline/skills/shared/external/swift-testing-pro/references/writing-better-tests.md +173 -147
- package/pipeline/skills/shared/external/swiftdata-pro/SKILL.md +75 -59
- package/pipeline/skills/shared/external/swiftdata-pro/evals/evals.json +50 -0
- package/pipeline/skills/shared/external/swiftdata-pro/references/cloudkit.md +34 -7
- package/pipeline/skills/shared/external/swiftdata-pro/references/indexing.md +20 -14
- package/pipeline/skills/shared/external/swiftdata-pro/references/inheritance.md +127 -0
- package/pipeline/skills/shared/external/swiftdata-pro/references/model-rules.md +141 -0
- package/pipeline/skills/shared/external/swiftdata-pro/references/predicates.md +37 -44
- package/pipeline/skills/shared/external/swiftlint/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/SKILL.md +89 -88
- package/pipeline/skills/shared/external/swiftui-expert-skill/evals/evals.json +55 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/accessibility-patterns.md +104 -122
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-advanced.md +73 -93
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-basics.md +144 -169
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-transitions.md +122 -133
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts-accessibility.md +141 -99
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts.md +273 -333
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/image-optimization.md +105 -128
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/latest-apis.md +199 -312
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/layout-best-practices.md +129 -169
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/liquid-glass.md +17 -30
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/list-patterns.md +198 -258
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-scenes.md +145 -218
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-views.md +150 -249
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-window-styling.md +109 -208
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/performance-patterns.md +225 -271
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/scroll-patterns.md +117 -210
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/sheet-navigation-patterns.md +171 -237
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/state-management.md +196 -260
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/view-structure.md +167 -230
- package/pipeline/skills/shared/external/swiftui-gestures/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swiftui-layout-components/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swiftui-navigation/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +1 -2
- package/pipeline/skills/shared/external/swiftui-patterns/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swiftui-performance/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/SKILL.md +71 -79
- package/pipeline/skills/shared/external/swiftui-performance-audit/evals/evals.json +55 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/audit-layout.md +50 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/capture-checklist.md +51 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/hangs.md +34 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/instruments-guide.md +68 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/smell-catalog.md +191 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/update-model.md +69 -0
- package/pipeline/skills/shared/external/swiftui-pro/SKILL.md +65 -63
- package/pipeline/skills/shared/external/swiftui-pro/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/swiftui-pro/references/accessibility.md +40 -13
- package/pipeline/skills/shared/external/swiftui-pro/references/api.md +74 -29
- package/pipeline/skills/shared/external/swiftui-pro/references/data.md +44 -24
- package/pipeline/skills/shared/external/swiftui-pro/references/design.md +45 -31
- package/pipeline/skills/shared/external/swiftui-pro/references/hygiene.md +17 -8
- package/pipeline/skills/shared/external/swiftui-pro/references/navigation.md +19 -9
- package/pipeline/skills/shared/external/swiftui-pro/references/performance.md +50 -34
- package/pipeline/skills/shared/external/swiftui-pro/references/swift.md +73 -45
- package/pipeline/skills/shared/external/swiftui-pro/references/views.md +48 -23
- package/pipeline/skills/shared/external/swiftui-ui-patterns/SKILL.md +89 -83
- package/pipeline/skills/shared/external/swiftui-ui-patterns/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/app-wiring.md +119 -114
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/async-state.md +76 -61
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/components-index.md +63 -46
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/controls.md +32 -31
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/deeplinks.md +49 -38
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/focus.md +77 -49
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/form.md +61 -44
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/grids.md +40 -42
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/input-toolbar.md +44 -31
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/lightweight-clients.md +90 -64
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/list.md +48 -49
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/loading-placeholders.md +36 -25
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/macos-settings.md +30 -30
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/matched-transitions.md +49 -32
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/media.md +49 -41
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/menu-bar.md +52 -48
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/navigationstack.md +119 -104
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/overlay.md +30 -27
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/performance.md +33 -31
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/previews.md +27 -27
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scroll-reveal.md +79 -86
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scrollview.md +47 -40
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/searchable.md +55 -40
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/sheets.md +113 -84
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/split-views.md +37 -34
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/tabview.md +75 -75
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/theming.md +37 -32
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/title-menus.md +41 -51
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/top-bar.md +46 -30
- package/pipeline/skills/shared/external/swiftui-uikit-interop/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-view-refactor/SKILL.md +152 -121
- package/pipeline/skills/shared/external/swiftui-view-refactor/evals/evals.json +56 -0
- package/pipeline/skills/shared/external/swiftui-view-refactor/references/mv-patterns.md +107 -98
- package/pipeline/skills/shared/external/swiftui-webkit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/tailwind-css/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/test-result-triage/SKILL.md +2 -2
- package/pipeline/skills/shared/external/test-result-triage/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/testing-backend/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/tipkit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/typescript-patterns/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/valven-rules/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/vision-framework/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/vue-composition/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/weatherkit/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/web-accessibility/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/web-performance/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/web-testing/SKILL.md +2 -2
- package/pipeline/skills/shared/external/web-testing/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +2 -2
- package/pipeline/skills/shared/external/widgetkit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/xcode-build-benchmark/SKILL.md +61 -55
- package/pipeline/skills/shared/external/xcode-build-benchmark/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmark-artifacts.md +69 -67
- package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmarking-workflow.md +39 -47
- package/pipeline/skills/shared/external/xcode-build-benchmark/schemas/build-benchmark.schema.json +72 -154
- package/pipeline/skills/shared/external/xcode-build-benchmark/scripts/benchmark_builds.py +207 -245
- package/pipeline/skills/shared/external/xcode-build-fixer/SKILL.md +145 -139
- package/pipeline/skills/shared/external/xcode-build-fixer/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-build-fixer/references/build-settings-best-practices.md +81 -175
- package/pipeline/skills/shared/external/xcode-build-fixer/references/fix-patterns.md +188 -143
- package/pipeline/skills/shared/external/xcode-build-fixer/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/xcode-build-fixer/scripts/benchmark_builds.py +207 -245
- package/pipeline/skills/shared/external/xcode-build-orchestrator/SKILL.md +107 -98
- package/pipeline/skills/shared/external/xcode-build-orchestrator/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/benchmark-artifacts.md +69 -67
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/build-settings-best-practices.md +81 -175
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/orchestration-report-template.md +81 -69
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/benchmark_builds.py +207 -245
- package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/diagnose_compilation.py +155 -210
- package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/generate_optimization_report.py +355 -480
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/SKILL.md +70 -69
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/build-optimization-sources.md +83 -133
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/code-compilation-checks.md +85 -73
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/scripts/diagnose_compilation.py +155 -210
- package/pipeline/skills/shared/external/xcode-project-analyzer/SKILL.md +54 -52
- package/pipeline/skills/shared/external/xcode-project-analyzer/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-optimization-sources.md +83 -133
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-settings-best-practices.md +81 -175
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/project-audit-checks.md +115 -83
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/recommendation-format.md +41 -40
- package/pipeline/scripts/_notices.mjs +0 -171
- package/pipeline/skills/shared/external/NOTICE-avdlee-swiftui-agent-skill.md +0 -48
- package/pipeline/skills/shared/external/NOTICE-dimillian-skills.md +0 -63
- package/pipeline/skills/shared/external/NOTICE-paul-hudson-skills.md +0 -54
- package/pipeline/skills/shared/external/NOTICE-vibeship-spawner-skills.md +0 -203
- package/pipeline/skills/shared/external/NOTICE-xcode-build-skills.md +0 -60
- package/pipeline/skills/shared/external/ios-iphone-duo/NOTICE.md +0 -53
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/main.swift +0 -11
- package/pipeline/skills/shared/external/swiftdata-pro/references/class-inheritance.md +0 -104
- package/pipeline/skills/shared/external/swiftdata-pro/references/core-rules.md +0 -20
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/code-smells.md +0 -158
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +0 -46
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +0 -29
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/profiling-intake.md +0 -44
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/report-template.md +0 -47
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +0 -33
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +0 -52
package/pipeline/skills/shared/external/swiftui-expert-skill/references/performance-patterns.md
CHANGED
|
@@ -1,410 +1,364 @@
|
|
|
1
|
-
# SwiftUI Performance
|
|
1
|
+
# SwiftUI Performance
|
|
2
2
|
|
|
3
3
|
<!-- toc -->
|
|
4
|
-
- [
|
|
5
|
-
- [
|
|
6
|
-
- [
|
|
7
|
-
- [
|
|
4
|
+
- [Where SwiftUI time goes](#where-swiftui-time-goes)
|
|
5
|
+
- [Fewer state writes](#fewer-state-writes)
|
|
6
|
+
- [Narrow dependencies](#narrow-dependencies)
|
|
7
|
+
- [Cheaper diffing](#cheaper-diffing)
|
|
8
|
+
- [Lazy containers](#lazy-containers)
|
|
9
|
+
- [Async work tied to the view](#async-work-tied-to-the-view)
|
|
10
|
+
- [Closures that may run off the main thread](#closures-that-may-run-off-the-main-thread)
|
|
11
|
+
- [Finding the trigger of an update](#finding-the-trigger-of-an-update)
|
|
12
|
+
- [Body anti-patterns](#body-anti-patterns)
|
|
13
|
+
- [Checklist](#checklist)
|
|
8
14
|
<!-- /toc -->
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
Treat every item here as a suggestion to weigh, not a rule to enforce. When a screen is actually slow, recommend profiling it with the SwiftUI template in Instruments before changing code.
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
- [Anti-Patterns](#anti-patterns)
|
|
14
|
-
- [Summary Checklist](#summary-checklist)
|
|
18
|
+
## Where SwiftUI time goes
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
The usual culprits:
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
- Broad state changes that invalidate many views at once
|
|
23
|
+
- Lists with unstable identity, which force extra diffing
|
|
24
|
+
- Expensive work inside `body`: formatting, sorting, decoding images
|
|
25
|
+
- Layout thrash from deeply nested stacks or long preference chains
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
## Fewer state writes
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
// BAD - triggers update even if value unchanged
|
|
24
|
-
.onReceive(publisher) { value in
|
|
25
|
-
self.currentValue = value // Always triggers body re-evaluation
|
|
26
|
-
}
|
|
29
|
+
### Skip writes that change nothing
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
Assigning to state schedules an update whether or not the new value differs. SwiftUI does not compare first, so the guard is yours:
|
|
32
|
+
|
|
33
|
+
```swift
|
|
34
|
+
.onReceive(batteryMonitor.levelPublisher) { level in
|
|
35
|
+
guard level != batteryLevel else { return }
|
|
36
|
+
batteryLevel = level
|
|
33
37
|
}
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
Writing `batteryLevel = level` unconditionally re-evaluates `body` on every emission, even repeated values.
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
### Guard hot paths
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
// BAD - updates state on every scroll position change
|
|
42
|
-
.onPreferenceChange(ScrollOffsetKey.self) { offset in
|
|
43
|
-
shouldShowTitle = offset.y <= -32 // Fires constantly during scroll!
|
|
44
|
-
}
|
|
44
|
+
Scroll callbacks, gesture handlers and animation ticks fire many times per second. Write to state only when a derived value actually flips:
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
.onPreferenceChange(
|
|
48
|
-
let
|
|
49
|
-
if
|
|
50
|
-
|
|
46
|
+
```swift
|
|
47
|
+
.onPreferenceChange(HeaderOffsetKey.self) { offsetY in
|
|
48
|
+
let collapsed = offsetY < -48
|
|
49
|
+
if collapsed != isHeaderCollapsed {
|
|
50
|
+
isHeaderCollapsed = collapsed
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Assigning `isHeaderCollapsed = offsetY < -48` on every callback triggers an update on each scroll frame; the comparison limits it to the moment the threshold is crossed.
|
|
56
|
+
|
|
57
|
+
## Narrow dependencies
|
|
58
|
+
|
|
59
|
+
### Hand views only what they read
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
Do not pass a big settings or context object to a view that uses one field of it:
|
|
58
62
|
|
|
59
63
|
```swift
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
// Narrow: each control depends on one value
|
|
65
|
+
AccentPicker(accent: settings.accent)
|
|
66
|
+
LineSpacingSlider(spacing: settings.lineSpacing)
|
|
63
67
|
|
|
64
|
-
//
|
|
65
|
-
|
|
68
|
+
// Broad: the picker now hears about every settings change
|
|
69
|
+
AccentPicker(settings: settings)
|
|
66
70
|
```
|
|
67
71
|
|
|
68
|
-
With `ObservableObject`, any `@Published` change
|
|
72
|
+
With `ObservableObject`, any `@Published` change notifies every observer. `@Observable` only updates views whose read properties changed, but passing the whole object still widens the dependency surface more than needed.
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
For views with expensive bodies, conform to `Equatable`:
|
|
74
|
+
The same applies to rows that pull a whole model from the environment just for one value:
|
|
73
75
|
|
|
74
76
|
```swift
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var body: some View {
|
|
83
|
-
// Expensive computation
|
|
84
|
-
}
|
|
77
|
+
// Broad: the row depends on the shared model
|
|
78
|
+
struct TransactionRow: View {
|
|
79
|
+
@Environment(LedgerModel.self) private var ledger
|
|
80
|
+
let entry: Entry
|
|
81
|
+
var body: some View { Text(entry.memo).foregroundStyle(ledger.palette.income) }
|
|
85
82
|
}
|
|
86
83
|
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
// Narrow: the row gets exactly what it draws
|
|
85
|
+
struct TransactionRow: View {
|
|
86
|
+
let entry: Entry
|
|
87
|
+
let incomeColor: Color
|
|
88
|
+
var body: some View { Text(entry.memo).foregroundStyle(incomeColor) }
|
|
89
|
+
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
### Keep fast-changing values out of the environment
|
|
93
|
+
|
|
94
|
+
When an environment value changes, SwiftUI checks every view that reads the environment, including views that never read that particular key. With many views and frequent updates (geometry, timers) this adds up, so such values should travel another way. (WWDC25 session 306, on optimizing SwiftUI with Instruments.)
|
|
93
95
|
|
|
94
|
-
###
|
|
96
|
+
### One observable per row
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
When every row reads the same `@Observable` collection, mutating one element invalidates all rows. Giving each row its own small observable state narrows the update to the row that changed.
|
|
97
99
|
|
|
98
100
|
```swift
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var body: some View {
|
|
105
|
-
Text("\(title): \(count)")
|
|
106
|
-
}
|
|
101
|
+
// Every row depends on the whole set
|
|
102
|
+
@Observable
|
|
103
|
+
final class PodcastLibrary {
|
|
104
|
+
var downloaded: Set<Episode.ID> = []
|
|
105
|
+
func isDownloaded(_ episode: Episode) -> Bool { downloaded.contains(episode.id) }
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
struct EpisodeRow: View {
|
|
109
|
+
let episode: Episode
|
|
110
|
+
@Environment(PodcastLibrary.self) private var library
|
|
111
|
+
|
|
114
112
|
var body: some View {
|
|
115
|
-
|
|
113
|
+
HStack {
|
|
114
|
+
Text(episode.title)
|
|
115
|
+
if library.isDownloaded(episode) {
|
|
116
|
+
Image(systemName: "arrow.down.circle.fill")
|
|
117
|
+
}
|
|
118
|
+
}
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
```
|
|
119
122
|
|
|
120
|
-
**Advanced Pattern**: Wrap expensive non-POD views in POD parent views:
|
|
121
|
-
|
|
122
123
|
```swift
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var body: some View {
|
|
128
|
-
ExpensiveViewInternal(value: value)
|
|
129
|
-
}
|
|
124
|
+
// Each row observes only its own state
|
|
125
|
+
@Observable
|
|
126
|
+
final class EpisodeState {
|
|
127
|
+
var isDownloaded = false
|
|
130
128
|
}
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
struct EpisodeRow: View {
|
|
131
|
+
let episode: Episode
|
|
132
|
+
let state: EpisodeState
|
|
133
|
+
|
|
137
134
|
var body: some View {
|
|
138
|
-
|
|
135
|
+
HStack {
|
|
136
|
+
Text(episode.title)
|
|
137
|
+
if state.isDownloaded {
|
|
138
|
+
Image(systemName: "arrow.down.circle.fill")
|
|
139
|
+
}
|
|
140
|
+
}
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
```
|
|
142
144
|
|
|
143
|
-
|
|
145
|
+
In the first version, downloading one episode changes the shared set and every `EpisodeRow` re-runs `body`. In the second, only the row whose `EpisodeState` changed does. Adopt per-item holders where they measurably cut updates. (WWDC25 session 306.)
|
|
146
|
+
|
|
147
|
+
## Cheaper diffing
|
|
144
148
|
|
|
145
|
-
###
|
|
149
|
+
### Equatable views
|
|
146
150
|
|
|
147
|
-
|
|
151
|
+
A view with an expensive body can conform to `Equatable` and be wrapped with `.equatable()`, so SwiftUI uses your comparison:
|
|
148
152
|
|
|
149
153
|
```swift
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
154
|
+
struct WaveformView: View, Equatable {
|
|
155
|
+
let clip: AudioClip
|
|
156
|
+
|
|
157
|
+
static func == (lhs: WaveformView, rhs: WaveformView) -> Bool {
|
|
158
|
+
lhs.clip.id == rhs.clip.id && lhs.clip.revision == rhs.clip.revision
|
|
156
159
|
}
|
|
157
|
-
}
|
|
158
160
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
ForEach(items) { item in
|
|
163
|
-
ExpensiveRow(item: item)
|
|
161
|
+
var body: some View {
|
|
162
|
+
Canvas { context, size in
|
|
163
|
+
// costly drawing
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
```
|
|
168
167
|
|
|
169
|
-
|
|
168
|
+
WaveformView(clip: clip)
|
|
169
|
+
.equatable()
|
|
170
|
+
```
|
|
170
171
|
|
|
171
|
-
|
|
172
|
+
Whenever the view gains a new input or state, update `==` to match, or the view will stop refreshing when it should.
|
|
172
173
|
|
|
173
|
-
###
|
|
174
|
+
### POD views
|
|
174
175
|
|
|
175
|
-
|
|
176
|
+
A view whose stored properties are only plain value types, with no property wrappers, is POD (plain old data). SwiftUI diffs POD views with `memcmp`, the fastest path. Adding any wrapper such as `@State` makes it non-POD, which falls back to reflection or custom equality.
|
|
176
177
|
|
|
177
178
|
```swift
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Text(item.name)
|
|
184
|
-
}
|
|
185
|
-
.task {
|
|
186
|
-
// Automatically cancelled when view disappears
|
|
187
|
-
data = await fetchData()
|
|
188
|
-
}
|
|
189
|
-
}
|
|
179
|
+
// POD: compared with memcmp
|
|
180
|
+
struct ScoreLabel: View {
|
|
181
|
+
let team: String
|
|
182
|
+
let points: Int
|
|
183
|
+
var body: some View { Text("\(team) \(points)") }
|
|
190
184
|
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### 8. Debug View Updates
|
|
194
185
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
@State private var name = ""
|
|
201
|
-
|
|
202
|
-
var body: some View {
|
|
203
|
-
#if DEBUG
|
|
204
|
-
let _ = Self._logChanges() // Xcode 15.1+: logs to com.apple.SwiftUI subsystem
|
|
205
|
-
#endif
|
|
206
|
-
|
|
207
|
-
VStack {
|
|
208
|
-
Text("Count: \(count)")
|
|
209
|
-
Text("Name: \(name)")
|
|
210
|
-
}
|
|
211
|
-
}
|
|
186
|
+
// Non-POD: the @State wrapper rules out memcmp
|
|
187
|
+
struct ScoreCard: View {
|
|
188
|
+
let team: String
|
|
189
|
+
@State private var showsHistory = false
|
|
190
|
+
var body: some View { Text(team) }
|
|
212
191
|
}
|
|
213
192
|
```
|
|
214
193
|
|
|
215
|
-
|
|
216
|
-
- `Self._logChanges()` (iOS 17+): Logs to the `com.apple.SwiftUI` subsystem with category "Changed Body Properties", using `os_log` for structured output.
|
|
217
|
-
|
|
218
|
-
Both print `@self` when the view value itself changed and `@identity` when the view's persistent data was recycled.
|
|
219
|
-
|
|
220
|
-
**Why**: This helps identify which state changes are causing view updates. Isolating redraw triggers into single-responsibility subviews is often the fix -- extracting a subview means SwiftUI can skip its body when its inputs haven't changed.
|
|
221
|
-
|
|
222
|
-
### 9. Eliminate Unnecessary Dependencies
|
|
223
|
-
|
|
224
|
-
**Narrow state scope to reduce update fan-out.** Instead of passing an entire `@Observable` model to a row view (which creates a dependency on all accessed properties), pass only the specific values the view needs as `let` properties.
|
|
194
|
+
An advanced variant puts a POD shell around a stateful, expensive view. The shell is compared with `memcmp`, and the inner view is diffed only when the shell's input changes:
|
|
225
195
|
|
|
226
196
|
```swift
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
let item: Item
|
|
231
|
-
var body: some View { Text(item.name).foregroundStyle(model.theme.primaryColor) }
|
|
197
|
+
struct StockChart: View {
|
|
198
|
+
let symbolID: Int
|
|
199
|
+
var body: some View { StockChartContent(symbolID: symbolID) }
|
|
232
200
|
}
|
|
233
201
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var body: some View { Text(item.name).foregroundStyle(themeColor) }
|
|
202
|
+
private struct StockChartContent: View {
|
|
203
|
+
let symbolID: Int
|
|
204
|
+
@State private var quotes: [Quote] = []
|
|
205
|
+
var body: some View { EmptyView() /* expensive rendering */ }
|
|
239
206
|
}
|
|
240
207
|
```
|
|
241
208
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
> Source: "Optimize SwiftUI performance with Instruments" (WWDC25, session 306)
|
|
209
|
+
## Lazy containers
|
|
245
210
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
**Consider per-item `@Observable` state holders (one per row/item) to narrow update scope.** When multiple list items share a dependency on the same `@Observable` array, changing one element causes all items to re-evaluate their bodies.
|
|
211
|
+
Large collections in a scroll view belong in a lazy stack, which builds rows as they come on screen instead of all at once:
|
|
249
212
|
|
|
250
213
|
```swift
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
func isFavorite(_ landmark: Landmark) -> Bool {
|
|
257
|
-
favorites.contains(landmark)
|
|
214
|
+
ScrollView {
|
|
215
|
+
LazyVStack {
|
|
216
|
+
ForEach(messages) { message in
|
|
217
|
+
MessageBubble(message: message)
|
|
218
|
+
}
|
|
258
219
|
}
|
|
259
220
|
}
|
|
221
|
+
```
|
|
260
222
|
|
|
261
|
-
|
|
262
|
-
let landmark: Landmark
|
|
263
|
-
@Environment(ModelData.self) private var model
|
|
223
|
+
A plain `VStack` in the same place creates every `MessageBubble` immediately.
|
|
264
224
|
|
|
265
|
-
|
|
266
|
-
HStack {
|
|
267
|
-
Text(landmark.name)
|
|
268
|
-
if model.isFavorite(landmark) {
|
|
269
|
-
Image(systemName: "heart.fill")
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
225
|
+
From iOS 26, lazy stacks inside nested scroll views also wait until their children are about to appear, the same as a top-level lazy stack. A horizontal carousel inside a vertical feed is the typical beneficiary. (WWDC25 session 256, what's new in SwiftUI.)
|
|
274
226
|
|
|
275
|
-
|
|
276
|
-
@Observable
|
|
277
|
-
class LandmarkViewModel {
|
|
278
|
-
var isFavorite: Bool = false
|
|
279
|
-
}
|
|
227
|
+
## Async work tied to the view
|
|
280
228
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
229
|
+
`.task` starts work when the view appears and cancels it automatically when the view goes away:
|
|
230
|
+
|
|
231
|
+
```swift
|
|
232
|
+
struct ForecastScreen: View {
|
|
233
|
+
@State private var days: [DayForecast] = []
|
|
284
234
|
|
|
285
235
|
var body: some View {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if viewModel.isFavorite {
|
|
289
|
-
Image(systemName: "heart.fill")
|
|
290
|
-
}
|
|
291
|
-
}
|
|
236
|
+
List(days) { day in Text(day.summary) }
|
|
237
|
+
.task { days = await WeatherService.loadWeek() }
|
|
292
238
|
}
|
|
293
239
|
}
|
|
294
240
|
```
|
|
295
241
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
> Source: "Optimize SwiftUI performance with Instruments" (WWDC25, session 306)
|
|
242
|
+
## Closures that may run off the main thread
|
|
299
243
|
|
|
300
|
-
|
|
244
|
+
For speed, SwiftUI may call some closures on a background thread. They must be `Sendable` and must not touch `@MainActor` state directly; copy what they need through the capture list instead. The closures in question:
|
|
301
245
|
|
|
302
|
-
**SwiftUI may call certain closures on a background thread for performance.** These closures must be `Sendable` and should avoid accessing `@MainActor`-isolated state directly. Instead, capture needed values in the closure's capture list.
|
|
303
|
-
|
|
304
|
-
Closures that may run off the main thread:
|
|
305
246
|
- `Shape.path(in:)`
|
|
306
|
-
- `visualEffect` closure
|
|
247
|
+
- the `visualEffect` closure
|
|
307
248
|
- `Layout` protocol methods
|
|
308
|
-
-
|
|
249
|
+
- the transform closure of `onGeometryChange`
|
|
309
250
|
|
|
310
251
|
```swift
|
|
311
|
-
//
|
|
312
|
-
.visualEffect { content,
|
|
313
|
-
content.
|
|
252
|
+
// Does not compile: reads main-actor state from a Sendable closure
|
|
253
|
+
.visualEffect { content, proxy in
|
|
254
|
+
content.scaleEffect(self.isHighlighted ? 1.1 : 1)
|
|
314
255
|
}
|
|
315
256
|
|
|
316
|
-
//
|
|
317
|
-
.visualEffect { [
|
|
318
|
-
content.
|
|
257
|
+
// Compiles: the value is captured up front
|
|
258
|
+
.visualEffect { [isHighlighted] content, proxy in
|
|
259
|
+
content.scaleEffect(isHighlighted ? 1.1 : 1)
|
|
319
260
|
}
|
|
320
261
|
```
|
|
321
262
|
|
|
322
|
-
|
|
263
|
+
(WWDC25 session 266, on concurrency in SwiftUI.)
|
|
264
|
+
|
|
265
|
+
## Finding the trigger of an update
|
|
266
|
+
|
|
267
|
+
`Self._printChanges()` and `Self._logChanges()` report why a body ran:
|
|
323
268
|
|
|
324
|
-
|
|
269
|
+
```swift
|
|
270
|
+
struct CartSummary: View {
|
|
271
|
+
@State private var itemCount = 0
|
|
272
|
+
@State private var couponCode = ""
|
|
273
|
+
|
|
274
|
+
var body: some View {
|
|
275
|
+
#if DEBUG
|
|
276
|
+
let _ = Self._logChanges()
|
|
277
|
+
#endif
|
|
278
|
+
VStack {
|
|
279
|
+
Text("Items: \(itemCount)")
|
|
280
|
+
Text("Coupon: \(couponCode)")
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
```
|
|
325
285
|
|
|
326
|
-
|
|
286
|
+
- `Self._printChanges()` writes the changed properties to standard output.
|
|
287
|
+
- `Self._logChanges()` (iOS 17+, Xcode 15.1+) sends the same through `os_log` to the `com.apple.SwiftUI` subsystem, category "Changed Body Properties".
|
|
327
288
|
|
|
328
|
-
|
|
329
|
-
- Unstable identity in lists causing excessive diffing
|
|
330
|
-
- Heavy work in `body` (formatting, sorting, image decoding)
|
|
331
|
-
- Layout thrash from deep stacks or preference chains
|
|
289
|
+
Both report `@self` when the view value itself changed and `@identity` when the view's persistent storage was recycled. The usual remedy is to move the triggering state into a focused subview, whose body SwiftUI can then skip while its inputs stay the same.
|
|
332
290
|
|
|
333
|
-
|
|
291
|
+
## Body anti-patterns
|
|
334
292
|
|
|
335
|
-
|
|
293
|
+
### Allocating in body
|
|
336
294
|
|
|
337
|
-
|
|
295
|
+
`body` runs often, so objects built there are rebuilt every time. Keep formatters and similar objects static or stored:
|
|
338
296
|
|
|
339
297
|
```swift
|
|
340
|
-
//
|
|
298
|
+
// Rebuilt on each evaluation
|
|
341
299
|
var body: some View {
|
|
342
|
-
let formatter =
|
|
343
|
-
formatter.
|
|
344
|
-
return Text(formatter.string(from:
|
|
300
|
+
let formatter = NumberFormatter()
|
|
301
|
+
formatter.numberStyle = .currency
|
|
302
|
+
return Text(formatter.string(from: price as NSNumber) ?? "")
|
|
345
303
|
}
|
|
346
304
|
|
|
347
|
-
//
|
|
348
|
-
private static let
|
|
349
|
-
let
|
|
350
|
-
|
|
351
|
-
return
|
|
305
|
+
// Built once
|
|
306
|
+
private static let currency: NumberFormatter = {
|
|
307
|
+
let formatter = NumberFormatter()
|
|
308
|
+
formatter.numberStyle = .currency
|
|
309
|
+
return formatter
|
|
352
310
|
}()
|
|
353
311
|
|
|
354
312
|
var body: some View {
|
|
355
|
-
Text(Self.
|
|
313
|
+
Text(Self.currency.string(from: price as NSNumber) ?? "")
|
|
356
314
|
}
|
|
357
315
|
```
|
|
358
316
|
|
|
359
|
-
###
|
|
317
|
+
### Heavy logic in body
|
|
360
318
|
|
|
361
|
-
|
|
319
|
+
`body` should be a pure, simple description of state: no side effects, no dispatching, no complex logic. Sorting, filtering and formatting move into the model or a computed property, or are recomputed only when the input changes:
|
|
362
320
|
|
|
363
321
|
```swift
|
|
364
|
-
//
|
|
322
|
+
// Sorts on every evaluation
|
|
365
323
|
var body: some View {
|
|
366
|
-
List(
|
|
324
|
+
List(contacts.sorted { $0.lastName < $1.lastName }) { Text($0.lastName) }
|
|
367
325
|
}
|
|
368
326
|
|
|
369
|
-
//
|
|
370
|
-
@State private var
|
|
327
|
+
// Sorts only when the source changes
|
|
328
|
+
@State private var sortedContacts: [Contact] = []
|
|
371
329
|
|
|
372
330
|
var body: some View {
|
|
373
|
-
List(
|
|
374
|
-
.onChange(of:
|
|
375
|
-
|
|
331
|
+
List(sortedContacts) { Text($0.lastName) }
|
|
332
|
+
.onChange(of: contacts) { _, latest in
|
|
333
|
+
sortedContacts = latest.sorted { $0.lastName < $1.lastName }
|
|
376
334
|
}
|
|
377
335
|
}
|
|
378
336
|
```
|
|
379
337
|
|
|
380
|
-
|
|
338
|
+
### Storing derived values
|
|
381
339
|
|
|
382
|
-
|
|
340
|
+
Values that can be computed from other state should not be stored next to it:
|
|
383
341
|
|
|
384
342
|
```swift
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
@State private var itemCount: Int = 0 // Unnecessary!
|
|
388
|
-
|
|
389
|
-
// GOOD - compute derived values
|
|
390
|
-
@State private var items: [Item] = []
|
|
391
|
-
|
|
392
|
-
var itemCount: Int { items.count } // Computed property
|
|
343
|
+
@State private var tasks: [TaskItem] = []
|
|
344
|
+
var openTaskCount: Int { tasks.filter { !$0.isDone }.count }
|
|
393
345
|
```
|
|
394
346
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
- [ ]
|
|
400
|
-
- [ ]
|
|
401
|
-
- [ ]
|
|
402
|
-
- [ ]
|
|
403
|
-
- [ ]
|
|
404
|
-
- [ ]
|
|
405
|
-
- [ ]
|
|
406
|
-
- [ ]
|
|
407
|
-
- [ ]
|
|
408
|
-
- [ ]
|
|
409
|
-
- [ ]
|
|
410
|
-
- [ ]
|
|
347
|
+
A separate `@State private var openTaskCount = 0` is redundant and can drift out of sync.
|
|
348
|
+
|
|
349
|
+
## Checklist
|
|
350
|
+
|
|
351
|
+
- [ ] State is assigned only when the value really changes
|
|
352
|
+
- [ ] Hot paths (scroll, gesture, animation) write state as rarely as possible
|
|
353
|
+
- [ ] Views receive the values they need, not large config objects
|
|
354
|
+
- [ ] Big collections use `LazyVStack` or `LazyHStack`
|
|
355
|
+
- [ ] No object allocation inside `body`
|
|
356
|
+
- [ ] Heavy computation lives outside `body`
|
|
357
|
+
- [ ] `body` is simple and free of side effects
|
|
358
|
+
- [ ] Derived values are computed, not stored
|
|
359
|
+
- [ ] `Self._logChanges()` or `Self._printChanges()` used to chase unexpected updates
|
|
360
|
+
- [ ] Expensive views use `Equatable` where it fits
|
|
361
|
+
- [ ] POD wrappers considered as an advanced optimization
|
|
362
|
+
- [ ] Per-row `@Observable` state considered where it measurably reduces updates
|
|
363
|
+
- [ ] Fast-changing values kept out of the environment
|
|
364
|
+
- [ ] Sendable closures (Shape, visualEffect, Layout, onGeometryChange) capture values instead of reading `@MainActor` state
|