@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.
Files changed (469) hide show
  1. package/CHANGELOG.md +123 -49
  2. package/README.md +12 -10
  3. package/README.tr.md +12 -10
  4. package/docs/adr/0006-skills-core-external-split.md +5 -5
  5. package/docs/adr/0010-own-code-graph.md +6 -7
  6. package/docs/adr/0013-lsp-code-intelligence.md +6 -8
  7. package/docs/adr/0017-change-impact-from-the-graph.md +4 -5
  8. package/docs/adr/0018-cross-repo-links-not-a-global-graph.md +1 -1
  9. package/docs/adr/README.md +1 -1
  10. package/docs/ecosystem.md +53 -41
  11. package/docs/facts.json +15 -13
  12. package/docs/features.md +2 -2
  13. package/docs/recovery-guide.md +1 -1
  14. package/install/_dev-only-files.mjs +3 -0
  15. package/install/_platform-filter.mjs +1 -23
  16. package/install/catalog-history.json +1 -1
  17. package/install/claude.mjs +8 -1
  18. package/install/codex.mjs +0 -2
  19. package/install/copilot.mjs +0 -2
  20. package/install/templates/claude-hooks.json +47 -1
  21. package/manifest.json +455 -332
  22. package/package.json +5 -2
  23. package/pipeline/agents/security-auditor.md +58 -6
  24. package/pipeline/commands/multi-agent/build-optimize/SKILL.md +1 -2
  25. package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +1 -1
  26. package/pipeline/commands/multi-agent/design-check/SKILL.md +1 -1
  27. package/pipeline/commands/multi-agent/graph/SKILL.md +12 -3
  28. package/pipeline/commands/multi-agent/manual-test/SKILL.md +12 -7
  29. package/pipeline/commands/multi-agent/research/SKILL.md +2 -2
  30. package/pipeline/commands/multi-agent/search/SKILL.md +10 -1
  31. package/pipeline/commands/multi-agent/security-review/SKILL.md +4 -0
  32. package/pipeline/commands/multi-agent/setup/SKILL.md +1 -0
  33. package/pipeline/commands/multi-agent/stack/SKILL.md +8 -0
  34. package/pipeline/commands/multi-agent/store-ready/SKILL.md +1 -1
  35. package/pipeline/commands/sim-test.md +34 -1
  36. package/pipeline/lib/context-budget.mjs +103 -0
  37. package/pipeline/lib/credential-inventory.sh +2 -3
  38. package/pipeline/lib/identifier-scan.mjs +145 -0
  39. package/pipeline/lib/outbound-gate.mjs +28 -1
  40. package/pipeline/lib/unattended-profile-check.mjs +13 -4
  41. package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
  42. package/pipeline/multi-agent-refs/analysis/redesign.md +17 -3
  43. package/pipeline/multi-agent-refs/analysis-template-corporate.md +8 -4
  44. package/pipeline/multi-agent-refs/analysis-template.md +7 -5
  45. package/pipeline/multi-agent-refs/audit-guide.md +20 -0
  46. package/pipeline/multi-agent-refs/complaint-analysis/phases.md +1 -0
  47. package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +1 -1
  48. package/pipeline/multi-agent-refs/features/code-graph.md +25 -0
  49. package/pipeline/multi-agent-refs/features/commit-multi-repo.md +63 -0
  50. package/pipeline/multi-agent-refs/features/design-conformance.md +20 -4
  51. package/pipeline/multi-agent-refs/features/dev-multi-repo.md +51 -0
  52. package/pipeline/multi-agent-refs/features/free-models.md +10 -3
  53. package/pipeline/multi-agent-refs/features/research.md +4 -3
  54. package/pipeline/multi-agent-refs/features/security-audit.md +25 -3
  55. package/pipeline/multi-agent-refs/features/test-gap.md +40 -0
  56. package/pipeline/multi-agent-refs/features/unattended-security.md +20 -0
  57. package/pipeline/multi-agent-refs/features/worktree-finalize.md +1 -1
  58. package/pipeline/multi-agent-refs/help/en.md +15 -9
  59. package/pipeline/multi-agent-refs/help/tr.md +15 -9
  60. package/pipeline/multi-agent-refs/knowledge.md +17 -0
  61. package/pipeline/multi-agent-refs/orchestrator/phase-3-user-test.md +12 -9
  62. package/pipeline/multi-agent-refs/outside-the-pipeline.md +9 -0
  63. package/pipeline/multi-agent-refs/phases/log-format.md +5 -0
  64. package/pipeline/multi-agent-refs/phases/operations.md +3 -5
  65. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
  66. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +8 -47
  67. package/pipeline/multi-agent-refs/phases/phase-3-review.md +21 -65
  68. package/pipeline/multi-agent-refs/phases/phase-4-commit.md +9 -59
  69. package/pipeline/multi-agent-refs/phases/phase-5-report.md +0 -31
  70. package/pipeline/multi-agent-refs/picker-contract.md +1 -1
  71. package/pipeline/multi-agent-refs/research/engine.md +2 -1
  72. package/pipeline/multi-agent-refs/rules.md +1 -1
  73. package/pipeline/multi-agent-refs/setup/free-models.md +10 -0
  74. package/pipeline/multi-agent-refs/store-ready/gate-3-policy.md +15 -0
  75. package/pipeline/multi-agent-refs/web-guide.md +2 -1
  76. package/pipeline/office/index.html +8 -9
  77. package/pipeline/office/toolkit.json +1 -1
  78. package/pipeline/rules/figma-pipeline.md +6 -3
  79. package/pipeline/rules/outside-the-pipeline.md +1 -1
  80. package/pipeline/schemas/learnings-ledger.schema.json +7 -2
  81. package/pipeline/schemas/prefs.schema.json +17 -4
  82. package/pipeline/schemas/reviewer-output.schema.json +113 -5
  83. package/pipeline/schemas/secret-patterns.json +49 -0
  84. package/pipeline/schemas/security-finding.schema.json +49 -5
  85. package/pipeline/scripts/_code-graph.mjs +3 -3
  86. package/pipeline/scripts/_graph-analysis.mjs +51 -0
  87. package/pipeline/scripts/_memory-policy.mjs +37 -7
  88. package/pipeline/scripts/_secret-scan.mjs +1 -1
  89. package/pipeline/scripts/_skill-practices.mjs +178 -0
  90. package/pipeline/scripts/_stack-routing.mjs +1 -0
  91. package/pipeline/scripts/autopilot-runner.mjs +8 -3
  92. package/pipeline/scripts/build-stack-plugins.mjs +8 -44
  93. package/pipeline/scripts/capture-resume.sh +19 -0
  94. package/pipeline/scripts/checkpoint-fold.sh +59 -0
  95. package/pipeline/scripts/file-context.mjs +306 -70
  96. package/pipeline/scripts/gate-ledger.mjs +1 -1
  97. package/pipeline/scripts/gen-skills-index.mjs +1 -1
  98. package/pipeline/scripts/graph-hint.mjs +197 -0
  99. package/pipeline/scripts/graph-hint.sh +20 -0
  100. package/pipeline/scripts/graph-query.mjs +306 -11
  101. package/pipeline/scripts/graph-report.mjs +29 -1
  102. package/pipeline/scripts/learnings-ledger.mjs +71 -15
  103. package/pipeline/scripts/note-agent-event.mjs +160 -0
  104. package/pipeline/scripts/note-agent-event.sh +19 -0
  105. package/pipeline/scripts/office-control.mjs +41 -15
  106. package/pipeline/scripts/offload-ref.sh +1 -1
  107. package/pipeline/scripts/parity-score.mjs +139 -0
  108. package/pipeline/scripts/pre-commit-check.sh +25 -4
  109. package/pipeline/scripts/pre-push-check.sh +3 -0
  110. package/pipeline/scripts/repo-recommend.mjs +321 -0
  111. package/pipeline/scripts/rework-rulings.mjs +5 -3
  112. package/pipeline/scripts/scan-agent-config.sh +1 -2
  113. package/pipeline/scripts/scope-check-gate.mjs +15 -2
  114. package/pipeline/scripts/security-evidence-gate.mjs +282 -0
  115. package/pipeline/scripts/unattended_policy.py +3 -2
  116. package/pipeline/scripts/user-test-handoff.sh +203 -0
  117. package/pipeline/scripts/validate-analysis-doc.mjs +17 -1
  118. package/pipeline/scripts/validate-planning.mjs +5 -3
  119. package/pipeline/scripts/validate-triage.mjs +2 -1
  120. package/pipeline/scripts/write-state.mjs +13 -4
  121. package/pipeline/skills/.skill-manifest.json +73 -69
  122. package/pipeline/skills/shared/README.md +41 -40
  123. package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +6 -6
  124. package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +1 -1
  125. package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +1 -1
  126. package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +1 -1
  127. package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +1 -1
  128. package/pipeline/skills/shared/core/multi-agent/SKILL.md +1 -1
  129. package/pipeline/skills/shared/core/multi-agent-build-optimize/SKILL.md +0 -1
  130. package/pipeline/skills/shared/core/multi-agent-complaint-analysis/SKILL.md +1 -1
  131. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +5 -5
  132. package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +10 -0
  133. package/pipeline/skills/shared/core/multi-agent-manual-test/SKILL.md +12 -7
  134. package/pipeline/skills/shared/core/multi-agent-research/SKILL.md +2 -2
  135. package/pipeline/skills/shared/core/multi-agent-search/SKILL.md +9 -0
  136. package/pipeline/skills/shared/core/multi-agent-security-review/SKILL.md +3 -2
  137. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +1 -0
  138. package/pipeline/skills/shared/core/multi-agent-stack/SKILL.md +8 -0
  139. package/pipeline/skills/shared/core/multi-agent-store-ready/SKILL.md +4 -3
  140. package/pipeline/skills/shared/core/multi-agent-test/SKILL.md +1 -1
  141. package/pipeline/skills/shared/core/multi-agent-test-accessibility/SKILL.md +1 -1
  142. package/pipeline/skills/shared/core/multi-agent-test-dark-mode/SKILL.md +1 -1
  143. package/pipeline/skills/shared/core/multi-agent-test-dynamic-type/SKILL.md +1 -1
  144. package/pipeline/skills/shared/core/multi-agent-test-gen/SKILL.md +1 -1
  145. package/pipeline/skills/shared/core/multi-agent-test-screenshots/SKILL.md +1 -1
  146. package/pipeline/skills/shared/core/multi-agent-testflight-validation/SKILL.md +2 -2
  147. package/pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/evals/evals.json +44 -0
  148. package/pipeline/skills/shared/external/agent-introspection-debugging/evals/evals.json +42 -0
  149. package/pipeline/skills/shared/external/android-architecture/SKILL.md +1 -1
  150. package/pipeline/skills/shared/external/android-architecture/evals/evals.json +45 -0
  151. package/pipeline/skills/shared/external/android-build-quality-gates/evals/evals.json +45 -0
  152. package/pipeline/skills/shared/external/android-datastore/evals/evals.json +45 -0
  153. package/pipeline/skills/shared/external/android-design-tokens-codegen/evals/evals.json +43 -0
  154. package/pipeline/skills/shared/external/android-jetpack-compose-expert/evals/evals.json +43 -0
  155. package/pipeline/skills/shared/external/android-mvi-viewmodel/evals/evals.json +45 -0
  156. package/pipeline/skills/shared/external/android-performance/SKILL.md +1 -1
  157. package/pipeline/skills/shared/external/android-performance/evals/evals.json +44 -0
  158. package/pipeline/skills/shared/external/android-security/SKILL.md +1 -1
  159. package/pipeline/skills/shared/external/android-security/evals/evals.json +45 -0
  160. package/pipeline/skills/shared/external/api-patterns/evals/evals.json +43 -0
  161. package/pipeline/skills/shared/external/api-security-best-practices/evals/evals.json +44 -0
  162. package/pipeline/skills/shared/external/app-store-changelog/SKILL.md +65 -49
  163. package/pipeline/skills/shared/external/app-store-changelog/evals/evals.json +40 -0
  164. package/pipeline/skills/shared/external/app-store-changelog/references/release-notes-guidelines.md +64 -34
  165. package/pipeline/skills/shared/external/app-store-changelog/scripts/collect_release_changes.sh +21 -23
  166. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +4 -1
  167. package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -0
  168. package/pipeline/skills/shared/external/architecture/evals/evals.json +42 -0
  169. package/pipeline/skills/shared/external/backlog/evals/evals.json +42 -0
  170. package/pipeline/skills/shared/external/ci-cd-pipelines/evals/evals.json +44 -0
  171. package/pipeline/skills/shared/external/clean-code/evals/evals.json +45 -0
  172. package/pipeline/skills/shared/external/compose-components/SKILL.md +1 -1
  173. package/pipeline/skills/shared/external/compose-components/evals/evals.json +44 -0
  174. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +1 -1
  175. package/pipeline/skills/shared/external/compose-navigation/evals/evals.json +43 -0
  176. package/pipeline/skills/shared/external/compose-testing/SKILL.md +1 -1
  177. package/pipeline/skills/shared/external/compose-testing/evals/evals.json +44 -0
  178. package/pipeline/skills/shared/external/context-compression/evals/evals.json +43 -0
  179. package/pipeline/skills/shared/external/core-data/SKILL.md +1 -1
  180. package/pipeline/skills/shared/external/council/evals/evals.json +41 -0
  181. package/pipeline/skills/shared/external/css-modern/evals/evals.json +44 -0
  182. package/pipeline/skills/shared/external/css-modern/references/code-examples.md +5 -0
  183. package/pipeline/skills/shared/external/database-patterns/evals/evals.json +46 -0
  184. package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +5 -0
  185. package/pipeline/skills/shared/external/debugging-strategies/evals/evals.json +43 -0
  186. package/pipeline/skills/shared/external/docker-expert/evals/evals.json +45 -0
  187. package/pipeline/skills/shared/external/e2e-testing/SKILL.md +21 -21
  188. package/pipeline/skills/shared/external/e2e-testing/evals/evals.json +44 -0
  189. package/pipeline/skills/shared/external/e2e-testing/references/document-fixtures.md +5 -5
  190. package/pipeline/skills/shared/external/evidence-github/evals/evals.json +41 -0
  191. package/pipeline/skills/shared/external/evidence-registry/SKILL.md +1 -1
  192. package/pipeline/skills/shared/external/evidence-registry/evals/evals.json +41 -0
  193. package/pipeline/skills/shared/external/fastapi-pro/evals/evals.json +57 -0
  194. package/pipeline/skills/shared/external/firebase/SKILL.md +132 -54
  195. package/pipeline/skills/shared/external/firebase/evals/evals.json +42 -0
  196. package/pipeline/skills/shared/external/firebase/references/functions-and-products.md +51 -0
  197. package/pipeline/skills/shared/external/firebase/references/security-rules.md +59 -0
  198. package/pipeline/skills/shared/external/fix-review-verdicts/evals/evals.json +57 -0
  199. package/pipeline/skills/shared/external/free-llm-apis/SKILL.md +70 -0
  200. package/pipeline/skills/shared/external/free-llm-apis/evals/evals.json +44 -0
  201. package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +33 -0
  202. package/pipeline/skills/shared/external/github-actions-templates/evals/evals.json +44 -0
  203. package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +1 -1
  204. package/pipeline/skills/shared/external/gradle-kotlin-dsl/evals/evals.json +58 -0
  205. package/pipeline/skills/shared/external/handle-request/SKILL.md +2 -2
  206. package/pipeline/skills/shared/external/handle-request/evals/evals.json +44 -0
  207. package/pipeline/skills/shared/external/hig-app-icons/SKILL.md +2 -2
  208. package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +1 -1
  209. package/pipeline/skills/shared/external/hig-components-content/evals/evals.json +43 -0
  210. package/pipeline/skills/shared/external/hig-components-status/evals/evals.json +43 -0
  211. package/pipeline/skills/shared/external/hig-components-system/evals/evals.json +43 -0
  212. package/pipeline/skills/shared/external/hig-inputs/evals/evals.json +44 -0
  213. package/pipeline/skills/shared/external/hig-patterns/evals/evals.json +46 -0
  214. package/pipeline/skills/shared/external/hig-platforms/evals/evals.json +45 -0
  215. package/pipeline/skills/shared/external/hig-technologies/evals/evals.json +44 -0
  216. package/pipeline/skills/shared/external/html-semantic/evals/evals.json +46 -0
  217. package/pipeline/skills/shared/external/humanizer/evals/evals.json +46 -0
  218. package/pipeline/skills/shared/external/ios-coding-standard/evals/evals.json +44 -0
  219. package/pipeline/skills/shared/external/ios-debugger-agent/SKILL.md +91 -52
  220. package/pipeline/skills/shared/external/ios-debugger-agent/evals/evals.json +41 -0
  221. package/pipeline/skills/shared/external/ios-design-review/SKILL.md +12 -12
  222. package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +16 -16
  223. package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +1 -1
  224. package/pipeline/skills/shared/external/ios-iphone-duo/SKILL.md +0 -1
  225. package/pipeline/skills/shared/external/ios-module-structure/evals/evals.json +42 -0
  226. package/pipeline/skills/shared/external/ios-security/SKILL.md +1 -1
  227. package/pipeline/skills/shared/external/ios-security/evals/evals.json +45 -0
  228. package/pipeline/skills/shared/external/kotlin-coroutines-expert/evals/evals.json +43 -0
  229. package/pipeline/skills/shared/external/localization-reuse-map/evals/evals.json +45 -0
  230. package/pipeline/skills/shared/external/macos-menubar-tuist-app/SKILL.md +170 -74
  231. package/pipeline/skills/shared/external/macos-menubar-tuist-app/evals/evals.json +52 -0
  232. package/pipeline/skills/shared/external/macos-spm-app-packaging/SKILL.md +119 -77
  233. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Package.swift +5 -5
  234. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/MyApp.swift +24 -0
  235. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/version.env +2 -0
  236. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/build_icon.sh +46 -39
  237. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/compile_and_run.sh +70 -49
  238. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/launch.sh +24 -17
  239. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/make_appcast.sh +74 -59
  240. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/package_app.sh +201 -170
  241. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +50 -42
  242. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +65 -35
  243. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/version.env +2 -0
  244. package/pipeline/skills/shared/external/macos-spm-app-packaging/evals/evals.json +45 -0
  245. package/pipeline/skills/shared/external/macos-spm-app-packaging/references/packaging.md +49 -17
  246. package/pipeline/skills/shared/external/macos-spm-app-packaging/references/release.md +48 -23
  247. package/pipeline/skills/shared/external/macos-spm-app-packaging/references/scaffold.md +74 -44
  248. package/pipeline/skills/shared/external/monorepo-architect/evals/evals.json +45 -0
  249. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +14 -3
  250. package/pipeline/skills/shared/external/nextjs-app-router/evals/evals.json +43 -0
  251. package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +3 -0
  252. package/pipeline/skills/shared/external/nodejs-backend-patterns/evals/evals.json +45 -0
  253. package/pipeline/skills/shared/external/observability-engineer/evals/evals.json +45 -0
  254. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +10 -0
  255. package/pipeline/skills/shared/external/photos-camera-media/evals/evals.json +45 -0
  256. package/pipeline/skills/shared/external/play-store-review/evals/evals.json +45 -0
  257. package/pipeline/skills/shared/external/python-patterns/evals/evals.json +46 -0
  258. package/pipeline/skills/shared/external/react-best-practices/evals/evals.json +43 -0
  259. package/pipeline/skills/shared/external/rest-api-design/evals/evals.json +46 -0
  260. package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +1 -1
  261. package/pipeline/skills/shared/external/retrofit-networking/evals/evals.json +43 -0
  262. package/pipeline/skills/shared/external/room-database/SKILL.md +1 -1
  263. package/pipeline/skills/shared/external/room-database/evals/evals.json +43 -0
  264. package/pipeline/skills/shared/external/scenario-gap-analysis/SKILL.md +1 -1
  265. package/pipeline/skills/shared/external/scenario-gap-analysis/evals/evals.json +43 -0
  266. package/pipeline/skills/shared/external/search-first/evals/evals.json +42 -0
  267. package/pipeline/skills/shared/external/security-review/SKILL.md +14 -3
  268. package/pipeline/skills/shared/external/security-review/evals/evals.json +48 -0
  269. package/pipeline/skills/shared/external/security-review/references/agentic-systems.md +93 -0
  270. package/pipeline/skills/shared/external/security-review/references/firebase-rules.md +100 -0
  271. package/pipeline/skills/shared/external/security-review/references/graphql.md +82 -0
  272. package/pipeline/skills/shared/external/security-review/references/llm-prompt-injection.md +93 -0
  273. package/pipeline/skills/shared/external/security-review/references/oauth-oidc.md +100 -0
  274. package/pipeline/skills/shared/external/security-review/references/owasp-mobile-top10-2024.md +1 -1
  275. package/pipeline/skills/shared/external/security-review/references/owasp-web-api-top10-2021.md +1 -1
  276. package/pipeline/skills/shared/external/security-review/references/supabase.md +73 -0
  277. package/pipeline/skills/shared/external/signal-community/SKILL.md +29 -10
  278. package/pipeline/skills/shared/external/signal-community/evals/evals.json +42 -0
  279. package/pipeline/skills/shared/external/skill-creator/evals/evals.json +43 -0
  280. package/pipeline/skills/shared/external/skill-creator/template.md +1 -3
  281. package/pipeline/skills/shared/external/spm-build-analysis/SKILL.md +80 -61
  282. package/pipeline/skills/shared/external/spm-build-analysis/evals/evals.json +56 -0
  283. package/pipeline/skills/shared/external/spm-build-analysis/references/build-optimization-sources.md +83 -133
  284. package/pipeline/skills/shared/external/spm-build-analysis/references/recommendation-format.md +41 -40
  285. package/pipeline/skills/shared/external/spm-build-analysis/references/spm-analysis-checks.md +89 -87
  286. package/pipeline/skills/shared/external/spm-build-analysis/scripts/check_spm_pins.py +90 -85
  287. package/pipeline/skills/shared/external/swift-concurrency-expert/SKILL.md +78 -69
  288. package/pipeline/skills/shared/external/swift-concurrency-expert/evals/evals.json +54 -0
  289. package/pipeline/skills/shared/external/swift-concurrency-expert/references/approachable-concurrency.md +52 -48
  290. package/pipeline/skills/shared/external/swift-concurrency-expert/references/swift-6-2-concurrency.md +118 -184
  291. package/pipeline/skills/shared/external/swift-concurrency-expert/references/swiftui-concurrency-tour-wwdc.md +68 -22
  292. package/pipeline/skills/shared/external/swift-concurrency-pro/SKILL.md +117 -94
  293. package/pipeline/skills/shared/external/swift-concurrency-pro/evals/evals.json +57 -0
  294. package/pipeline/skills/shared/external/swift-concurrency-pro/references/actors.md +102 -97
  295. package/pipeline/skills/shared/external/swift-concurrency-pro/references/async-streams.md +36 -37
  296. package/pipeline/skills/shared/external/swift-concurrency-pro/references/bridging.md +82 -34
  297. package/pipeline/skills/shared/external/swift-concurrency-pro/references/bug-patterns.md +90 -52
  298. package/pipeline/skills/shared/external/swift-concurrency-pro/references/cancellation.md +55 -55
  299. package/pipeline/skills/shared/external/swift-concurrency-pro/references/diagnostics.md +66 -43
  300. package/pipeline/skills/shared/external/swift-concurrency-pro/references/hotspots.md +39 -23
  301. package/pipeline/skills/shared/external/swift-concurrency-pro/references/interop.md +66 -68
  302. package/pipeline/skills/shared/external/swift-concurrency-pro/references/new-features.md +152 -131
  303. package/pipeline/skills/shared/external/swift-concurrency-pro/references/structured.md +60 -57
  304. package/pipeline/skills/shared/external/swift-concurrency-pro/references/testing.md +131 -118
  305. package/pipeline/skills/shared/external/swift-concurrency-pro/references/unstructured.md +37 -29
  306. package/pipeline/skills/shared/external/swift-formatstyle/evals/evals.json +43 -0
  307. package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +77 -58
  308. package/pipeline/skills/shared/external/swift-testing-pro/evals/evals.json +59 -0
  309. package/pipeline/skills/shared/external/swift-testing-pro/references/async-tests.md +139 -144
  310. package/pipeline/skills/shared/external/swift-testing-pro/references/core-rules.md +90 -28
  311. package/pipeline/skills/shared/external/swift-testing-pro/references/migrating-from-xctest.md +38 -21
  312. package/pipeline/skills/shared/external/swift-testing-pro/references/new-features.md +139 -156
  313. package/pipeline/skills/shared/external/swift-testing-pro/references/writing-better-tests.md +173 -147
  314. package/pipeline/skills/shared/external/swiftdata-pro/SKILL.md +75 -59
  315. package/pipeline/skills/shared/external/swiftdata-pro/evals/evals.json +50 -0
  316. package/pipeline/skills/shared/external/swiftdata-pro/references/cloudkit.md +34 -7
  317. package/pipeline/skills/shared/external/swiftdata-pro/references/indexing.md +20 -14
  318. package/pipeline/skills/shared/external/swiftdata-pro/references/inheritance.md +127 -0
  319. package/pipeline/skills/shared/external/swiftdata-pro/references/model-rules.md +141 -0
  320. package/pipeline/skills/shared/external/swiftdata-pro/references/predicates.md +37 -44
  321. package/pipeline/skills/shared/external/swiftlint/evals/evals.json +44 -0
  322. package/pipeline/skills/shared/external/swiftui-expert-skill/SKILL.md +89 -88
  323. package/pipeline/skills/shared/external/swiftui-expert-skill/evals/evals.json +55 -0
  324. package/pipeline/skills/shared/external/swiftui-expert-skill/references/accessibility-patterns.md +104 -122
  325. package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-advanced.md +73 -93
  326. package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-basics.md +144 -169
  327. package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-transitions.md +122 -133
  328. package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts-accessibility.md +141 -99
  329. package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts.md +273 -333
  330. package/pipeline/skills/shared/external/swiftui-expert-skill/references/image-optimization.md +105 -128
  331. package/pipeline/skills/shared/external/swiftui-expert-skill/references/latest-apis.md +199 -312
  332. package/pipeline/skills/shared/external/swiftui-expert-skill/references/layout-best-practices.md +129 -169
  333. package/pipeline/skills/shared/external/swiftui-expert-skill/references/liquid-glass.md +17 -30
  334. package/pipeline/skills/shared/external/swiftui-expert-skill/references/list-patterns.md +198 -258
  335. package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-scenes.md +145 -218
  336. package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-views.md +150 -249
  337. package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-window-styling.md +109 -208
  338. package/pipeline/skills/shared/external/swiftui-expert-skill/references/performance-patterns.md +225 -271
  339. package/pipeline/skills/shared/external/swiftui-expert-skill/references/scroll-patterns.md +117 -210
  340. package/pipeline/skills/shared/external/swiftui-expert-skill/references/sheet-navigation-patterns.md +171 -237
  341. package/pipeline/skills/shared/external/swiftui-expert-skill/references/state-management.md +196 -260
  342. package/pipeline/skills/shared/external/swiftui-expert-skill/references/view-structure.md +167 -230
  343. package/pipeline/skills/shared/external/swiftui-gestures/evals/evals.json +43 -0
  344. package/pipeline/skills/shared/external/swiftui-layout-components/evals/evals.json +43 -0
  345. package/pipeline/skills/shared/external/swiftui-navigation/evals/evals.json +44 -0
  346. package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +1 -2
  347. package/pipeline/skills/shared/external/swiftui-patterns/evals/evals.json +43 -0
  348. package/pipeline/skills/shared/external/swiftui-performance/evals/evals.json +44 -0
  349. package/pipeline/skills/shared/external/swiftui-performance-audit/SKILL.md +71 -79
  350. package/pipeline/skills/shared/external/swiftui-performance-audit/evals/evals.json +55 -0
  351. package/pipeline/skills/shared/external/swiftui-performance-audit/references/audit-layout.md +50 -0
  352. package/pipeline/skills/shared/external/swiftui-performance-audit/references/capture-checklist.md +51 -0
  353. package/pipeline/skills/shared/external/swiftui-performance-audit/references/hangs.md +34 -0
  354. package/pipeline/skills/shared/external/swiftui-performance-audit/references/instruments-guide.md +68 -0
  355. package/pipeline/skills/shared/external/swiftui-performance-audit/references/smell-catalog.md +191 -0
  356. package/pipeline/skills/shared/external/swiftui-performance-audit/references/update-model.md +69 -0
  357. package/pipeline/skills/shared/external/swiftui-pro/SKILL.md +65 -63
  358. package/pipeline/skills/shared/external/swiftui-pro/evals/evals.json +45 -0
  359. package/pipeline/skills/shared/external/swiftui-pro/references/accessibility.md +40 -13
  360. package/pipeline/skills/shared/external/swiftui-pro/references/api.md +74 -29
  361. package/pipeline/skills/shared/external/swiftui-pro/references/data.md +44 -24
  362. package/pipeline/skills/shared/external/swiftui-pro/references/design.md +45 -31
  363. package/pipeline/skills/shared/external/swiftui-pro/references/hygiene.md +17 -8
  364. package/pipeline/skills/shared/external/swiftui-pro/references/navigation.md +19 -9
  365. package/pipeline/skills/shared/external/swiftui-pro/references/performance.md +50 -34
  366. package/pipeline/skills/shared/external/swiftui-pro/references/swift.md +73 -45
  367. package/pipeline/skills/shared/external/swiftui-pro/references/views.md +48 -23
  368. package/pipeline/skills/shared/external/swiftui-ui-patterns/SKILL.md +89 -83
  369. package/pipeline/skills/shared/external/swiftui-ui-patterns/evals/evals.json +44 -0
  370. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/app-wiring.md +119 -114
  371. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/async-state.md +76 -61
  372. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/components-index.md +63 -46
  373. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/controls.md +32 -31
  374. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/deeplinks.md +49 -38
  375. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/focus.md +77 -49
  376. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/form.md +61 -44
  377. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/grids.md +40 -42
  378. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/input-toolbar.md +44 -31
  379. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/lightweight-clients.md +90 -64
  380. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/list.md +48 -49
  381. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/loading-placeholders.md +36 -25
  382. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/macos-settings.md +30 -30
  383. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/matched-transitions.md +49 -32
  384. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/media.md +49 -41
  385. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/menu-bar.md +52 -48
  386. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/navigationstack.md +119 -104
  387. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/overlay.md +30 -27
  388. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/performance.md +33 -31
  389. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/previews.md +27 -27
  390. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scroll-reveal.md +79 -86
  391. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scrollview.md +47 -40
  392. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/searchable.md +55 -40
  393. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/sheets.md +113 -84
  394. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/split-views.md +37 -34
  395. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/tabview.md +75 -75
  396. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/theming.md +37 -32
  397. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/title-menus.md +41 -51
  398. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/top-bar.md +46 -30
  399. package/pipeline/skills/shared/external/swiftui-uikit-interop/evals/evals.json +44 -0
  400. package/pipeline/skills/shared/external/swiftui-view-refactor/SKILL.md +152 -121
  401. package/pipeline/skills/shared/external/swiftui-view-refactor/evals/evals.json +56 -0
  402. package/pipeline/skills/shared/external/swiftui-view-refactor/references/mv-patterns.md +107 -98
  403. package/pipeline/skills/shared/external/swiftui-webkit/evals/evals.json +44 -0
  404. package/pipeline/skills/shared/external/tailwind-css/evals/evals.json +43 -0
  405. package/pipeline/skills/shared/external/test-result-triage/SKILL.md +2 -2
  406. package/pipeline/skills/shared/external/test-result-triage/evals/evals.json +44 -0
  407. package/pipeline/skills/shared/external/testing-backend/evals/evals.json +42 -0
  408. package/pipeline/skills/shared/external/tipkit/evals/evals.json +44 -0
  409. package/pipeline/skills/shared/external/typescript-patterns/evals/evals.json +42 -0
  410. package/pipeline/skills/shared/external/valven-rules/evals/evals.json +44 -0
  411. package/pipeline/skills/shared/external/vision-framework/evals/evals.json +44 -0
  412. package/pipeline/skills/shared/external/vue-composition/evals/evals.json +42 -0
  413. package/pipeline/skills/shared/external/weatherkit/evals/evals.json +42 -0
  414. package/pipeline/skills/shared/external/web-accessibility/evals/evals.json +43 -0
  415. package/pipeline/skills/shared/external/web-performance/evals/evals.json +44 -0
  416. package/pipeline/skills/shared/external/web-testing/SKILL.md +2 -2
  417. package/pipeline/skills/shared/external/web-testing/evals/evals.json +43 -0
  418. package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +2 -2
  419. package/pipeline/skills/shared/external/widgetkit/evals/evals.json +44 -0
  420. package/pipeline/skills/shared/external/xcode-build-benchmark/SKILL.md +61 -55
  421. package/pipeline/skills/shared/external/xcode-build-benchmark/evals/evals.json +42 -0
  422. package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmark-artifacts.md +69 -67
  423. package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmarking-workflow.md +39 -47
  424. package/pipeline/skills/shared/external/xcode-build-benchmark/schemas/build-benchmark.schema.json +72 -154
  425. package/pipeline/skills/shared/external/xcode-build-benchmark/scripts/benchmark_builds.py +207 -245
  426. package/pipeline/skills/shared/external/xcode-build-fixer/SKILL.md +145 -139
  427. package/pipeline/skills/shared/external/xcode-build-fixer/evals/evals.json +54 -0
  428. package/pipeline/skills/shared/external/xcode-build-fixer/references/build-settings-best-practices.md +81 -175
  429. package/pipeline/skills/shared/external/xcode-build-fixer/references/fix-patterns.md +188 -143
  430. package/pipeline/skills/shared/external/xcode-build-fixer/references/recommendation-format.md +41 -40
  431. package/pipeline/skills/shared/external/xcode-build-fixer/scripts/benchmark_builds.py +207 -245
  432. package/pipeline/skills/shared/external/xcode-build-orchestrator/SKILL.md +107 -98
  433. package/pipeline/skills/shared/external/xcode-build-orchestrator/evals/evals.json +54 -0
  434. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/benchmark-artifacts.md +69 -67
  435. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/build-settings-best-practices.md +81 -175
  436. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/orchestration-report-template.md +81 -69
  437. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/recommendation-format.md +41 -40
  438. package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/benchmark_builds.py +207 -245
  439. package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/diagnose_compilation.py +155 -210
  440. package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/generate_optimization_report.py +355 -480
  441. package/pipeline/skills/shared/external/xcode-compilation-analyzer/SKILL.md +70 -69
  442. package/pipeline/skills/shared/external/xcode-compilation-analyzer/evals/evals.json +54 -0
  443. package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/build-optimization-sources.md +83 -133
  444. package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/code-compilation-checks.md +85 -73
  445. package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/recommendation-format.md +41 -40
  446. package/pipeline/skills/shared/external/xcode-compilation-analyzer/scripts/diagnose_compilation.py +155 -210
  447. package/pipeline/skills/shared/external/xcode-project-analyzer/SKILL.md +54 -52
  448. package/pipeline/skills/shared/external/xcode-project-analyzer/evals/evals.json +54 -0
  449. package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-optimization-sources.md +83 -133
  450. package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-settings-best-practices.md +81 -175
  451. package/pipeline/skills/shared/external/xcode-project-analyzer/references/project-audit-checks.md +115 -83
  452. package/pipeline/skills/shared/external/xcode-project-analyzer/references/recommendation-format.md +41 -40
  453. package/pipeline/scripts/_notices.mjs +0 -171
  454. package/pipeline/skills/shared/external/NOTICE-avdlee-swiftui-agent-skill.md +0 -48
  455. package/pipeline/skills/shared/external/NOTICE-dimillian-skills.md +0 -63
  456. package/pipeline/skills/shared/external/NOTICE-paul-hudson-skills.md +0 -54
  457. package/pipeline/skills/shared/external/NOTICE-vibeship-spawner-skills.md +0 -203
  458. package/pipeline/skills/shared/external/NOTICE-xcode-build-skills.md +0 -60
  459. package/pipeline/skills/shared/external/ios-iphone-duo/NOTICE.md +0 -53
  460. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/main.swift +0 -11
  461. package/pipeline/skills/shared/external/swiftdata-pro/references/class-inheritance.md +0 -104
  462. package/pipeline/skills/shared/external/swiftdata-pro/references/core-rules.md +0 -20
  463. package/pipeline/skills/shared/external/swiftui-performance-audit/references/code-smells.md +0 -158
  464. package/pipeline/skills/shared/external/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +0 -46
  465. package/pipeline/skills/shared/external/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +0 -29
  466. package/pipeline/skills/shared/external/swiftui-performance-audit/references/profiling-intake.md +0 -44
  467. package/pipeline/skills/shared/external/swiftui-performance-audit/references/report-template.md +0 -47
  468. package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +0 -33
  469. package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +0 -52
@@ -1,39 +1,84 @@
1
- # Using modern SwiftUI API
2
-
3
- - Always use `foregroundStyle()` instead of `foregroundColor()`.
4
- - Always use `clipShape(.rect(cornerRadius:))` instead of `cornerRadius()`.
5
- - Always use the `Tab` API instead of `tabItem()`.
6
- - Never use the `onChange()` modifier in its 1-parameter variant; either use the variant that accepts two parameters or accepts none.
7
- - Do not use `GeometryReader` if a newer alternative works: `containerRelativeFrame()`, `visualEffect()`, or the `Layout` protocol. Flag `GeometryReader` usage and suggest the modern alternative.
8
- - When designing haptic effects, prefer using `sensoryFeedback()` over older UIKit APIs such as `UIImpactFeedbackGenerator`.
9
- - Use the `@Entry` macro to define custom `EnvironmentValues`, `FocusValues`, `Transaction`, and `ContainerValues` keys. This replaces the legacy pattern of manually creating a type conforming to (for example) `EnvironmentKey` with a `defaultValue`, then extending `EnvironmentValues` with a computed property.
10
- - Strongly prefer `overlay(alignment:content:)` over the deprecated `overlay(_:alignment:)`. For example, use `.overlay { Text("Hello, world!") }` rather than `.overlay(Text("Hello, world!"))`.
11
- - Never use `.navigationBarLeading` and `.navigationBarTrailing` for toolbar item placement; they are deprecated. The correct, modern placements are `.topBarLeading` and `.topBarTrailing`.
12
- - Prefer to rely on automatic grammar agreement when dealing with English, French, German, Portuguese, Spanish, and Italian. For example, use `Text("^[\(people) person](inflect: true)")` to show a number of people.
13
- - You can fill and stroke a shape with two chained modifiers; you do *not* need an overlay for the stroke. The overlay was required previously, but this is fixed in iOS 17 and later.
14
- - When referencing images from an asset catalog, prefer the generated symbol asset API when the project is configured to use them: `Image(.avatar)` rather than `Image("avatar")`.
15
- - When targeting iOS 26 and later, SwiftUI has a native `WebView` view type that replaces almost all uses of hand-wrapped `WKWebView` inside `UIViewRepresentable`. To use it, make sure to include `import WebKit`.
16
- - `ForEach` over an `enumerated()` sequence should not convert to an array first. Use `ForEach(items.enumerated(), id: \.element.id)` directly.
17
- - When hiding scroll indicators, use `.scrollIndicators(.hidden)` rather than `showsIndicators: false` in the initializer.
18
- - Never use `Text` concatenation with `+`.
19
-
20
- For example, the usage of `+` here is bad and deprecated:
1
+ # Modern API replacements
2
+
3
+ Each row names an older call and what replaces it. Any occurrence of the left
4
+ column is a finding.
5
+
6
+ | Older or discouraged | Use instead |
7
+ |----------------------|-------------|
8
+ | `foregroundColor()` | `foregroundStyle()` |
9
+ | `cornerRadius()` | `clipShape(.rect(cornerRadius:))` |
10
+ | `tabItem()` | the `Tab` API |
11
+ | one-parameter `onChange()` | the two-parameter or zero-parameter variant |
12
+ | `overlay(_:alignment:)` (deprecated), e.g. `.overlay(Badge())` | `overlay(alignment:content:)`, e.g. `.overlay { Badge() }` |
13
+ | `.navigationBarLeading` / `.navigationBarTrailing` toolbar placement (deprecated) | `.topBarLeading` / `.topBarTrailing` |
14
+ | `ScrollView(showsIndicators: false)` | `.scrollIndicators(.hidden)` |
15
+ | `UIImpactFeedbackGenerator` and other UIKit haptics | `sensoryFeedback()` |
16
+ | `Image("logo")` string lookup | `Image(.logo)` generated asset symbols, when the project enables them |
17
+ | `WKWebView` wrapped in `UIViewRepresentable` | native `WebView` on iOS 26 and later (needs `import WebKit`) |
18
+
19
+ ## Layout without GeometryReader
20
+
21
+ `GeometryReader` is a finding whenever a newer tool does the job:
22
+ `containerRelativeFrame()`, `visualEffect()` or a custom `Layout`. Name the
23
+ alternative in the report.
24
+
25
+ ## Custom environment and container keys
26
+
27
+ Define keys for `EnvironmentValues`, `FocusValues`, `Transaction` and
28
+ `ContainerValues` with the `@Entry` macro. It replaces the old two-step
29
+ pattern of a type conforming to `EnvironmentKey` (or similar) with a
30
+ `defaultValue`, plus a computed property in an extension.
21
31
 
22
32
  ```swift
23
- Text("Hello").foregroundStyle(.red)
24
- +
25
- Text("World").foregroundStyle(.blue)
33
+ extension EnvironmentValues {
34
+ @Entry var accentPalette: Palette = .standard
35
+ }
26
36
  ```
27
37
 
28
- Instead, use text interpolation like this:
38
+ ## Shapes
39
+
40
+ Filling and stroking a shape needs two chained modifiers, not an overlay for
41
+ the stroke. The overlay workaround stopped being necessary in iOS 17.
29
42
 
30
43
  ```swift
31
- let red = Text("Hello").foregroundStyle(.red)
32
- let blue = Text("World").foregroundStyle(.blue)
33
- Text("\(red)\(blue)")
44
+ Capsule()
45
+ .fill(.orange)
46
+ .stroke(.brown, lineWidth: 3)
34
47
  ```
35
48
 
49
+ ## Enumerated ForEach
50
+
51
+ Pass the enumerated sequence straight in, without wrapping it in an array
52
+ first: `ForEach(players.enumerated(), id: \.element.id) { index, player in ... }`.
53
+
54
+ ## Pluralization
55
+
56
+ For English, French, German, Portuguese, Spanish and Italian, let automatic
57
+ grammar agreement handle plurals:
58
+
59
+ ```swift
60
+ Text("^[\(unreadCount) message](inflect: true)")
61
+ ```
62
+
63
+ ## Text concatenation
64
+
65
+ Joining `Text` values with `+` is deprecated and a finding. Interpolate styled
66
+ `Text` values instead.
67
+
68
+ ```swift
69
+ // Finding
70
+ Text("Total: ").bold()
71
+ +
72
+ Text(priceLabel).foregroundStyle(.green)
73
+
74
+ // Fix
75
+ let caption = Text("Total: ").bold()
76
+ let amount = Text(priceLabel).foregroundStyle(.green)
77
+ Text("\(caption)\(amount)")
78
+ ```
36
79
 
37
- ## Using ObservableObject
80
+ ## ObservableObject and Combine
38
81
 
39
- If using `ObservableObject` is absolutely required - for example if you are trying to create a debouncer using a Combine publisher - you should always make sure `import Combine` is added. This was previously provided through SwiftUI, but that is no longer the case.
82
+ When `ObservableObject` genuinely cannot be avoided (a Combine-based debounce
83
+ pipeline is the typical case), the file must `import Combine` itself. SwiftUI
84
+ no longer re-exports it.
@@ -1,43 +1,63 @@
1
- # Data flow, shared state, and property wrappers
2
-
3
- It is important that SwiftUI body code and logic code be kept separate in order to make code easier to read, write, and maintain. That usually means placing code into methods rather than inline in the `body` property, but often also means carving functionality out into separate `@Observable` classes.
4
-
5
- These rules help ensure code is efficient and works well in the long term.
1
+ # Data flow and state
6
2
 
3
+ Keep layout and logic apart. The `body` describes the screen; behaviour lives
4
+ in methods and, for anything substantial, in `@Observable` classes. Code
5
+ written that way is easier to read, change and test.
7
6
 
8
7
  ## Shared state
9
8
 
10
- - `@Observable` classes must be marked `@MainActor` unless the project has Main Actor default actor isolation. Flag any `@Observable` class missing this annotation.
11
- - All shared data should use `@Observable` classes with `@State` (for ownership) and `@Bindable` / `@Environment` (for passing).
12
- - Strongly prefer not to use `ObservableObject`, `@Published`, `@StateObject`, `@ObservedObject`, or `@EnvironmentObject` unless they are unavoidable, or if they exist in legacy/integration contexts when changing architecture would be complicated.
13
-
9
+ - Every `@Observable` class needs `@MainActor`, unless the project already
10
+ sets Main Actor as its default actor isolation. A missing annotation is a
11
+ finding.
12
+ - Shared data lives in `@Observable` classes. The owning view holds it in
13
+ `@State`; descendants receive it through `@Bindable` or `@Environment`.
14
+ - `ObservableObject`, `@Published`, `@StateObject`, `@ObservedObject` and
15
+ `@EnvironmentObject` are to be avoided. Accept them only where nothing else
16
+ works, or in legacy and integration code where moving away would be costly.
14
17
 
15
18
  ## Local state
16
19
 
17
- - `@State` should be marked `private` and only owned by the view that created it.
18
- - If a view stores a class instance that contains expensive-to-recompute data, e.g. `CIContext`, it can be stored using `@State` even though it is not an observable object. This effectively uses `@State` as a cache - storing something persistently, but not doing any change tracking on it since it's not an observable object.
19
-
20
+ - `@State` properties are `private` and belong only to the view that created
21
+ them.
22
+ - `@State` can also act as a cache for a class instance that is costly to
23
+ build, such as a `CIContext`, even though that class is not observable.
24
+ The instance persists across body evaluations and no change tracking
25
+ happens.
20
26
 
21
27
  ## Bindings
22
28
 
23
- - Strongly prefer to avoid creating bindings using `Binding(get:set:)` in view body code. It is much cleaner and simpler to use a binding provided by `@State`, `@Binding` or similar, then use `onChange()` to trigger any effects.
24
- - If the user needs to enter a number into a `TextField`, bind the `TextField` to a numeric value such as `Int` or `Double`, then use its `format` initializer like this: `TextField("Enter your score", value: $score, format: .number)`. Apply either `.keyboardType(.numberPad)` (for integers) or `.keyboardType(.decimalPad)` (for floating-point numbers) as appropriate. Using the modifier alone is *not* sufficient.
29
+ - A `Binding(get:set:)` built inside the body is a finding. Bind to a
30
+ property from `@State`, `@Binding` or `@Bindable`, and run side effects in
31
+ `onChange()`.
32
+ - Numeric input in a `TextField` binds to a number (`Int`, `Double`) through
33
+ the `format` initializer, plus the matching keyboard. The keyboard modifier
34
+ on its own is not enough.
25
35
 
36
+ ```swift
37
+ TextField("Servings", value: $servings, format: .number)
38
+ .keyboardType(.numberPad)
26
39
 
27
- ## Working with data
40
+ TextField("Weight (kg)", value: $weight, format: .number)
41
+ .keyboardType(.decimalPad)
42
+ ```
28
43
 
29
- - Prefer to make structs conform to `Identifiable` rather than using `id: \.someProperty` in SwiftUI code.
30
- - Never attempt to use `@AppStorage` inside an `@Observable` class, even if marked `@ObservationIgnored` - it will *not* trigger view updates when a change happens.
44
+ ## Model types
31
45
 
46
+ - Conform model structs to `Identifiable` instead of passing
47
+ `id: \.someProperty` at each call site.
48
+ - `@AppStorage` inside an `@Observable` class does not work, even with
49
+ `@ObservationIgnored`: changes never refresh the views. Flag it.
32
50
 
33
51
  ## SwiftData
34
52
 
35
- - If you only need the number of items matching a query, consider `ModelContext.fetchCount()` with a fetch descriptor. This will *not* live update if the data changes unless something else triggers the update, such as `@Query`, so it should be used carefully.
36
-
37
- For more help with SwiftData, suggest the [SwiftData Pro agent skill](https://github.com/twostraws/swiftdata-agent-skill).
53
+ - When only a count of matching rows is needed, `ModelContext.fetchCount()`
54
+ with a `FetchDescriptor` is an option. It does not refresh by itself when
55
+ data changes; something else, such as a `@Query`, must trigger the update.
56
+ Use it with care.
57
+ - For deeper SwiftData work, point to the swiftdata-pro skill.
38
58
 
39
- ## If the project uses SwiftData with CloudKit
59
+ ### SwiftData backed by CloudKit
40
60
 
41
- - Never use `@Attribute(.unique)`.
42
- - Model properties must always either have default values or be marked as optional.
43
- - All relationships must be marked optional.
61
+ - No `@Attribute(.unique)` anywhere.
62
+ - Every model property has a default value or is optional.
63
+ - Every relationship is optional.
@@ -1,31 +1,45 @@
1
- # Design
2
-
3
- ## Creating a uniform design in this app
4
-
5
- Prefer to place standard fonts, sizes, colors, stack spacing, padding, rounding, animation timings, and more into a shared enum of constants, so they can be used by all views. This allows the app's design to feel uniform and consistent, and be adjusted easily.
6
-
7
-
8
- ## Requirements for flexible, accessible design
9
-
10
- - Never use `UIScreen.main.bounds` to read available space; prefer alternatives such as `containerRelativeFrame()`, or `visualEffect()` as appropriate, or (if there is no alternative) `GeometryReader`.
11
- - Prefer to avoid fixed frames for views unless content can fit neatly inside; this can cause problems across different device sizes, different Dynamic Type settings, and more. Giving frames some flexibility is usually preferred.
12
- - Apple's minimum acceptable tap area for interactions on iOS is 44x44. Ensure this is strictly enforced.
13
-
14
-
15
- ## Standard system styling
16
-
17
- - Strongly prefer to use `ContentUnavailableView` when data is missing or empty, rather than designing something custom.
18
- - When using `searchable()`, you can show empty results using `ContentUnavailableView.search` and it will include the search term they used automatically - there's no need to use `ContentUnavailableView.search(text: searchText)` or similar.
19
- - If you need an icon and some text placed horizontally side by side, prefer `Label` over `HStack`.
20
- - Prefer system hierarchical styles (e.g. secondary/tertiary) over manual opacity when possible, so the system can adapt to the correct context automatically.
21
- - When using `Form`, wrap controls such as `Slider` in `LabeledContent` so the title and control are laid out correctly.
22
- - When using `RoundedRectangle`, the default rounding style is `.continuous` - there is no need to specify it explicitly.
23
-
24
-
25
- ## Ensuring designs work for everyone
26
-
27
- - Use `bold()` instead of `fontWeight(.bold)`, because using `bold()` allows the system to choose the correct weight for the current context.
28
- - Only use `fontWeight()` for weights other than bold when there's an important reason - scattering around `fontWeight(.medium)` or `fontWeight(.semibold)` is counterproductive.
29
- - Avoid hard-coded values for padding and stack spacing unless specifically requested.
30
- - Avoid UIKit colors (`UIColor`) in SwiftUI code; use SwiftUI `Color` or asset catalog colors.
31
- - The font size `.caption2` is extremely small, and is generally best avoided. Even the font size `.caption` is on the small side, and should be used carefully.
1
+ # Design checks
2
+
3
+ ## One source for design values
4
+
5
+ Fonts, sizes, colors, stack spacing, padding, corner radii, animation timings
6
+ and similar values belong in a shared enum of constants that every view
7
+ reads. The app then looks consistent and can be retuned in one place.
8
+
9
+ ## Flexible layout
10
+
11
+ - Reading `UIScreen.main.bounds` for available space is a finding. Use
12
+ `containerRelativeFrame()` or `visualEffect()`, and `GeometryReader` only
13
+ when neither fits.
14
+ - Fixed frames break across device sizes and Dynamic Type settings. Keep them
15
+ for content that is certain to fit, and otherwise give the frame room to
16
+ grow.
17
+ - Every interactive element on iOS needs a hit area of at least 44x44 points,
18
+ Apple's minimum. Enforce it strictly.
19
+
20
+ ## System components first
21
+
22
+ - Empty or missing data is shown with `ContentUnavailableView`, not a custom
23
+ placeholder.
24
+ - Under `searchable()`, `ContentUnavailableView.search` already includes the
25
+ query the user typed. Passing the text yourself, as in
26
+ `ContentUnavailableView.search(text: query)`, is unnecessary.
27
+ - An icon beside a piece of text is a `Label`, not an `HStack`.
28
+ - Use hierarchical styles (`.secondary`, `.tertiary`) rather than lowering
29
+ opacity by hand, so the system adapts them to context.
30
+ - Inside a `Form`, wrap controls such as `Slider` in `LabeledContent` so title
31
+ and control line up.
32
+ - `RoundedRectangle` already defaults to `.continuous` corners; spelling it out
33
+ adds nothing.
34
+
35
+ ## Type and color
36
+
37
+ - Prefer `bold()` to `fontWeight(.bold)`; `bold()` lets the system pick the
38
+ right weight for the context.
39
+ - Other weights such as `.medium` or `.semibold` need a real reason. Scattering
40
+ them around works against a consistent look.
41
+ - Hard-coded padding and stack spacing are a finding unless the user asked for
42
+ specific values.
43
+ - `UIColor` does not belong in SwiftUI code. Use `Color` or asset catalog colors.
44
+ - `.caption2` is very small and usually best avoided; `.caption` is also small
45
+ and should be used sparingly.
@@ -1,9 +1,18 @@
1
- # Hygiene
1
+ # Hygiene checks
2
2
 
3
- - If the project requires secrets such as API keys, never include them in the repository.
4
- - Code comments and documentation comments should be present where the logic isn't self-evident.
5
- - Unit tests should exist for core application logic. UI tests only where unit tests are not possible.
6
- - `@AppStorage` must never be used to store usernames, passwords, or other sensitive data. Use the keychain for that.
7
- - If SwiftLint is configured, it should return no warnings or errors.
8
- - If the project uses Localizable.xcstrings, prefer to add user-facing strings using symbol keys (e.g. "helloWorld") in the string catalog with `extractionState` set to "manual", accessing them via generated symbols such as `Text(.helloWorld)`. Offer to translate new keys into all languages supported by the project.
9
- - If the Xcode MCP is configured, prefer its tools over generic alternatives. For example, `RenderPreview` is able to capture images of rendered SwiftUI previews for examination, and `DocumentationSearch` can search Apple's documentation for latest usage instructions.
3
+ - Secrets such as API keys stay out of the repository.
4
+ - Logic that is not obvious from the code itself carries a comment or a
5
+ documentation comment.
6
+ - Core app logic has unit tests. UI tests are reserved for what unit tests
7
+ cannot reach.
8
+ - `@AppStorage` never holds usernames, passwords or anything else sensitive;
9
+ that goes in the keychain.
10
+ - When SwiftLint is set up, it reports zero warnings and zero errors.
11
+ - In a project with `Localizable.xcstrings`, add user-facing strings to the
12
+ catalog under symbol keys (for example `welcomeTitle`) with
13
+ `extractionState` set to `manual`, and read them through generated symbols
14
+ such as `Text(.welcomeTitle)`. Offer to translate new keys into every
15
+ language the project supports.
16
+ - When the Xcode MCP server is available, use its tools ahead of generic ones:
17
+ `RenderPreview` captures rendered SwiftUI previews for inspection and
18
+ `DocumentationSearch` looks up current Apple documentation.
@@ -1,14 +1,24 @@
1
1
  # Navigation and presentation
2
2
 
3
- - Use `NavigationStack` or `NavigationSplitView` as appropriate; flag all use of the deprecated `NavigationView`.
4
- - Strongly prefer to use `navigationDestination(for:)` to specify destinations; flag all use of the old `NavigationLink(destination:)` pattern where it should be replaced.
5
- - Never mix `navigationDestination(for:)` and `NavigationLink(destination:)` in the same navigation hierarchy; it causes significant problems.
6
- - `navigationDestination(for:)` must be registered once per data type; flag duplicates.
3
+ ## Stacks and destinations
7
4
 
5
+ - `NavigationView` is deprecated; any use is a finding. Replace it with
6
+ `NavigationStack` or `NavigationSplitView`, whichever fits.
7
+ - Destinations are declared with `navigationDestination(for:)`. The older
8
+ `NavigationLink(destination:)` form is a finding wherever it can be replaced.
9
+ - One hierarchy must not mix `navigationDestination(for:)` with
10
+ `NavigationLink(destination:)`; the combination causes serious problems.
11
+ - Each data type gets exactly one `navigationDestination(for:)` registration.
12
+ Duplicates are a finding.
8
13
 
9
- ## Alerts, confirmation dialogs, and sheets
14
+ ## Sheets, alerts and dialogs
10
15
 
11
- - Always attach `confirmationDialog()` to the user interface that triggers the dialog. This allows Liquid Glass animations to move from the correct source.
12
- - If an alert has only a single "OK" button that does nothing but dismiss the alert, it can be omitted entirely: `.alert("Dismiss Me", isPresented: $isShowingAlert) { }`.
13
- - If a sheet is designed to present an optional piece of data, prefer `sheet(item:)` over `sheet(isPresented:)` so the optional is safely unwrapped.
14
- - When using `sheet(item:)` with a view that accepts the item as its only initializer parameter, prefer `sheet(item: $someItem, content: SomeView.init)` over `sheet(item: $someItem) { someItem in SomeView(item: someItem) }`.
16
+ - Attach `confirmationDialog()` to the control that opens it, so the Liquid
17
+ Glass animation starts from the right place.
18
+ - An alert whose only button is an "OK" that just dismisses can drop the
19
+ button entirely: `.alert("Saved", isPresented: $showsSavedAlert) { }`.
20
+ - A sheet that presents an optional value uses `sheet(item:)` rather than
21
+ `sheet(isPresented:)`, so the value is unwrapped safely.
22
+ - When the presented view takes the item as its only initializer argument,
23
+ pass the initializer directly: `sheet(item: $editingNote, content: NoteEditor.init)`
24
+ instead of `sheet(item: $editingNote) { note in NoteEditor(note: note) }`.
@@ -1,46 +1,62 @@
1
- # Performance
2
-
3
- - When toggling modifier values, prefer ternary expressions over if/else view branching to avoid `_ConditionalContent`, preserve structural identity, and avoid repeatedly recreating underlying platform views.
4
- - Avoid `AnyView` unless absolutely required. Use `@ViewBuilder`, `Group`, or generics instead.
5
- - If a `ScrollView` has an opaque, static, and solid background, prefer to use `scrollContentBackground(.visible)` to improve scroll-edge rendering efficiency.
6
- - It is more efficient to break views up by making dedicated SwiftUI views rather than place them into computed properties or methods. Using `@ViewBuilder` on a property or method does not solve this; breaking views up is strongly preferred.
7
- - Always ensure view initializers are kept as small and simple as possible, avoiding any non-trivial work. Flag any work that can be moved into a `task()` modifier to be run when the view is shown.
8
- - Similarly, assume each view's `body` property is called frequently - if logic such as sorting or filtering can be moved out of there easily, it should be.
9
- - Avoid creating properties to store formatters such as `DateFormatter` unless they are required. A more natural approach is to use `Text` with a format, like this: `Text(Date.now, format: .dateTime.day().month().year())` or `Text(100, format: .currency(code: "USD"))`.
10
- - Avoid expensive inline transforms in `List`/`ForEach` initializers (e.g. `items.filter { ... }`) when they are repeated often.
11
- - Prefer deriving transformed data from the source-of-truth using `let`, or caching in `@State`. However, do not cache derived collections in `@State` unless you also own explicit invalidation logic to avoid stale UI.
12
- - For large data sets in `ScrollView`, use `LazyVStack`/`LazyHStack`; flag eager stacks with many children.
13
- - Prefer using `task()` over `onAppear()` when doing async work, because it will be cancelled automatically when the view disappears.
14
- - Avoid storing escaping `@ViewBuilder` closures on views when possible; store built view results instead.
15
-
16
- Example:
1
+ # Performance checks
2
+
3
+ ## View identity and structure
4
+
5
+ - To switch a modifier value, use a ternary rather than an `if`/`else` that
6
+ produces two view branches. The branch form creates `_ConditionalContent`,
7
+ loses structural identity and keeps rebuilding the underlying platform views.
8
+ - `AnyView` is a last resort. `@ViewBuilder`, `Group` or generics usually do
9
+ the job.
10
+ - Split large views into dedicated `View` structs. Computed properties or
11
+ methods returning views, even marked `@ViewBuilder`, do not give the same
12
+ benefit.
13
+ - Do not keep an escaping `@ViewBuilder` closure as a stored property. Store
14
+ the built view instead and let the synthesized initializer call the builder.
17
15
 
18
16
  ```swift
19
- // Anti-pattern: stores an escaping closure on the view.
20
- struct CardView<Content: View>: View {
21
- let content: () -> Content
17
+ // Finding: keeps the closure around and calls it on every body pass.
18
+ struct Panel<Body: View>: View {
19
+ let makeContent: () -> Body
22
20
 
23
21
  var body: some View {
24
- VStack(alignment: .leading) {
25
- content()
26
- }
27
- .padding()
28
- .background(.ultraThinMaterial)
29
- .clipShape(.rect(cornerRadius: 8))
22
+ VStack(spacing: 8) { makeContent() }
23
+ .padding()
24
+ .background(.regularMaterial, in: .rect(cornerRadius: 12))
30
25
  }
31
26
  }
32
27
 
33
- // Preferred: store the built view value; the synthesized init handles calling the builder.
34
- struct CardView<Content: View>: View {
35
- @ViewBuilder let content: Content
28
+ // Fix: the stored value is the built view.
29
+ struct Panel<Body: View>: View {
30
+ @ViewBuilder let content: Body
36
31
 
37
32
  var body: some View {
38
- VStack(alignment: .leading) {
39
- content
40
- }
41
- .padding()
42
- .background(.ultraThinMaterial)
43
- .clipShape(.rect(cornerRadius: 8))
33
+ VStack(spacing: 8) { content }
34
+ .padding()
35
+ .background(.regularMaterial, in: .rect(cornerRadius: 12))
44
36
  }
45
37
  }
46
38
  ```
39
+
40
+ ## Work done too often
41
+
42
+ - View initializers stay small and cheap. Anything non-trivial that can run in
43
+ a `task()` modifier when the view appears is a finding.
44
+ - Treat `body` as something that runs constantly. Sorting, filtering and
45
+ similar logic that can easily move out of it should.
46
+ - Inline transforms in `List` or `ForEach` initializers, such as
47
+ `orders.filter { ... }`, are costly when re-evaluated often.
48
+ - Derive transformed data from the source of truth with `let`, or cache it in
49
+ `@State`. Cache a derived collection in `@State` only when there is explicit
50
+ invalidation logic, otherwise the UI goes stale.
51
+ - Stored formatter properties such as a `DateFormatter` are rarely needed.
52
+ Format inside `Text`: `Text(dueDate, format: .dateTime.day().month().year())`
53
+ or `Text(total, format: .currency(code: "EUR"))`.
54
+
55
+ ## Scrolling and async work
56
+
57
+ - A `ScrollView` with many children uses `LazyVStack` or `LazyHStack`. Eager
58
+ stacks with large child counts are a finding.
59
+ - When the scroll view sits on an opaque, static, solid background,
60
+ `scrollContentBackground(.visible)` makes scroll-edge rendering cheaper.
61
+ - Async work starts in `task()`, not `onAppear()`, because `task()` is
62
+ cancelled automatically when the view goes away.
@@ -1,56 +1,84 @@
1
- # Swift
2
-
3
- - Prefer Swift-native string methods over Foundation equivalents: use `replacing("a", with: "b")` not `replacingOccurrences(of: "a", with: "b")`.
4
- - Prefer modern Foundation API: `URL.documentsDirectory` instead of `FileManager` directory lookups, `appending(path:)` to append strings to a URL.
5
- - Never use C-style number formatting like `String(format: "%.2f", value)`. Use `Text(value, format: .number.precision(.fractionLength(2)))` or similar `FormatStyle` APIs.
6
- - Prefer static member lookup to struct instances where possible, such as `.circle` rather than `Circle()`, and `.borderedProminent` rather than `BorderedProminentButtonStyle()`.
7
- - Avoid force unwraps (`!`) and force `try` unless the failure is truly unrecoverable, and even then prefer using `fatalError()` with a clear description. If possible, use `if let`, `guard let`, nil-coalescing, or `try?`/`do-catch`.
8
- - Filtering text based on user-input must be done using `localizedStandardContains()` as opposed to `contains()` or `localizedCaseInsensitiveContains()`.
9
- - Strongly prefer `Double` over `CGFloat`, except when using optionals or `inout`; Swift is able to bridge the two freely except in those two cases.
10
- - If you want to count array objects that match a predicate, always use `count(where:)` rather than `filter()` followed by `count`.
11
- - Prefer `Date.now` over `Date()` for clarity.
12
- - When `import SwiftUI` is already in a file, you do not need to add `import UIKit` or `import AppKit` to access things like `UIImage` or `NSImage` - they are imported automatically on the appropriate platform.
13
- - When dealing with the names of people, strongly prefer to use `PersonNameComponents` with modern formatting over simple string interpolation such as `Text("\(firstName) \(lastName)")`.
14
- - If a given type of data is repeatedly sorted using an identical closure, e.g. `books.sorted { $0.author < $1.author }`, prefer to make the type in question conform to `Comparable` so the sort order is centralized.
15
- - Prefer to avoid manual date formatting strings if possible. If manual date formatting *is* used for user display, at least make sure to use "y" rather than "yyyy" for years, so the year value is correct in all localizations. If the purpose is data exchange with an API, this rule does not apply.
16
- - When trying to convert a string to a date, prefer the modern `Date` initializer API such as `Date(myString, strategy: .iso8601)`.
17
- - Flag instances where errors triggered by a user action are swallowed silently, e.g. using `print(error.localizedDescription)` rather than showing an alert or similar.
18
- - Prefer `if let value {` shorthand over `if let value = value {`.
19
- - Omit return for single expression functions. `if` and `switch` can be used as expressions when returning values and assigning to variables.
20
-
21
- For example, this kind of code:
1
+ # Swift language checks
2
+
3
+ ## Strings, numbers and dates
4
+
5
+ - Use Swift string methods ahead of Foundation ones:
6
+ `title.replacing("_", with: " ")` instead of
7
+ `replacingOccurrences(of:with:)`.
8
+ - Search text the user typed with `localizedStandardContains()`, not
9
+ `contains()` or `localizedCaseInsensitiveContains()`.
10
+ - C-style formatting such as `String(format: "%.1f", rating)` is a finding.
11
+ Use `FormatStyle`, for example
12
+ `Text(rating, format: .number.precision(.fractionLength(1)))`.
13
+ - Write `Date.now`, not `Date()`.
14
+ - Parse dates with the modern initializers, for example
15
+ `Date(timestamp, strategy: .iso8601)`.
16
+ - Avoid hand-written date format strings. When one is used for display, years
17
+ are `y`, not `yyyy`, so every locale shows the right year. Format strings for
18
+ API data exchange are exempt.
19
+ - Display people's names with `PersonNameComponents` and its formatting, not
20
+ `Text("\(given) \(family)")`.
21
+
22
+ ## Foundation and types
23
+
24
+ - Use modern Foundation: `URL.documentsDirectory` instead of a `FileManager`
25
+ directory lookup, and `appending(path:)` to extend a URL.
26
+ - Prefer `Double` to `CGFloat`. The two bridge freely except for optionals and
27
+ `inout`, where `CGFloat` is still needed.
28
+ - Use static member lookup where it exists: `.capsule` rather than
29
+ `Capsule()`, `.bordered` rather than `BorderedButtonStyle()`.
30
+ - `import SwiftUI` already brings in UIKit or AppKit on the right platform.
31
+ A separate import just to use `UIImage` or `NSImage` is unnecessary.
32
+ - When one type is sorted with the same closure in several places, such as
33
+ `tracks.sorted { $0.duration < $1.duration }`, conform it to `Comparable`
34
+ so the ordering lives in one place.
35
+ - Count matches with `count(where:)`, not `filter()` followed by `.count`.
36
+
37
+ ## Control flow and errors
38
+
39
+ - Force unwraps and `try!` are only acceptable for truly unrecoverable
40
+ failures, and even then `fatalError()` with a clear message is better.
41
+ Prefer `if let`, `guard let`, `??`, `try?` or `do`/`catch`.
42
+ - An error from a user action that is swallowed, for example only printed
43
+ with `print(error.localizedDescription)`, is a finding. Surface it, for
44
+ instance with an alert.
45
+ - Use the shorthand `if let session {` instead of `if let session = session {`.
46
+ - Single-expression functions and properties drop `return`, and `if` and
47
+ `switch` work as expressions for returns and assignments.
22
48
 
23
49
  ```swift
24
- var tileColor: Color {
25
- if isCorrect {
50
+ // Finding
51
+ var badgeTint: Color {
52
+ switch status {
53
+ case .active:
26
54
  return .green
27
- } else {
28
- return .red
55
+ case .paused:
56
+ return .orange
29
57
  }
30
58
  }
31
- ```
32
-
33
- Should be written like this:
34
59
 
35
- ```swift
36
- var tileColor: Color {
37
- if isCorrect {
38
- .green
39
- } else {
40
- .red
60
+ // Fix
61
+ var badgeTint: Color {
62
+ switch status {
63
+ case .active: .green
64
+ case .paused: .orange
41
65
  }
42
66
  }
43
67
  ```
44
68
 
69
+ ## Concurrency
45
70
 
46
- ## Swift Concurrency
47
-
48
- - If an API offers both modern `async`/`await` equivalents and older closure-based variants, always prefer the `async`/`await` versions.
49
- - Never use Grand Central Dispatch (`DispatchQueue.main.async()`, `DispatchQueue.global()`, etc.). Always use modern Swift concurrency (`async`/`await`, actors, `Task`).
50
- - Never use `Task.sleep(nanoseconds:)`; use `Task.sleep(for:)` instead.
51
- - Flag any mutable shared state that isn't protected by an actor or `@MainActor`, unless the project is configured to use MainActor default actor isolation.
52
- - Assume strict concurrency rules are being applied; flag `@Sendable` violations and data races.
53
- - When evaluating `MainActor.run()`, check whether the project has its default actor isolation set to Main Actor first, because `MainActor.run()` might not be needed.
54
- - `Task.detached()` is often a bad idea. Check any usage extremely carefully.
55
-
56
- For more help with Swift concurrency, suggest the [Swift Concurrency Pro agent skill](https://github.com/twostraws/swift-concurrency-agent-skill).
71
+ - When an API has both an `async` version and a completion-handler version,
72
+ use the `async` one.
73
+ - Grand Central Dispatch (`DispatchQueue.main.async()`,
74
+ `DispatchQueue.global()` and the rest) is a finding. Use `async`/`await`,
75
+ actors and `Task`.
76
+ - `Task.sleep(nanoseconds:)` is a finding; use `Task.sleep(for:)`.
77
+ - Mutable shared state not protected by an actor or `@MainActor` is a finding,
78
+ unless the project defaults to Main Actor isolation.
79
+ - Assume strict concurrency checking. Flag `@Sendable` violations and data
80
+ races.
81
+ - Before judging a `MainActor.run()` call, check whether the project already
82
+ defaults to Main Actor isolation; if so, the call may be redundant.
83
+ - `Task.detached()` is frequently a mistake. Examine every use closely.
84
+ - For deeper concurrency questions, point to the swift-concurrency-pro skill.