@mmerterden/multi-agent-pipeline 20.7.0 → 20.8.1

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 (284) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +0 -10
  3. package/docs/facts.json +1 -1
  4. package/manifest.json +285 -285
  5. package/package.json +3 -3
  6. package/pipeline/lib/redact.mjs +3 -2
  7. package/pipeline/scripts/_notices.mjs +1 -1
  8. package/pipeline/scripts/gen-skills-index.mjs +13 -1
  9. package/pipeline/scripts/pre-commit-check.sh +4 -0
  10. package/pipeline/skills/.skill-manifest.json +69 -69
  11. package/pipeline/skills/shared/README.md +70 -70
  12. package/pipeline/skills/shared/external/alarmkit/SKILL.md +373 -381
  13. package/pipeline/skills/shared/external/alarmkit/evals/evals.json +23 -18
  14. package/pipeline/skills/shared/external/alarmkit/references/alarmkit-patterns.md +328 -378
  15. package/pipeline/skills/shared/external/app-clips/SKILL.md +260 -160
  16. package/pipeline/skills/shared/external/app-clips/evals/evals.json +27 -27
  17. package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +150 -83
  18. package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +135 -83
  19. package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +143 -85
  20. package/pipeline/skills/shared/external/app-intents/SKILL.md +302 -304
  21. package/pipeline/skills/shared/external/app-intents/evals/evals.json +21 -21
  22. package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +594 -894
  23. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +345 -277
  24. package/pipeline/skills/shared/external/app-store-optimization/evals/evals.json +27 -23
  25. package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +107 -121
  26. package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +145 -165
  27. package/pipeline/skills/shared/external/app-store-review/SKILL.md +306 -326
  28. package/pipeline/skills/shared/external/app-store-review/evals/evals.json +21 -21
  29. package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +105 -67
  30. package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +114 -101
  31. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +335 -360
  32. package/pipeline/skills/shared/external/apple-on-device-ai/evals/evals.json +24 -27
  33. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +215 -322
  34. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +161 -256
  35. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +277 -387
  36. package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +196 -210
  37. package/pipeline/skills/shared/external/authentication/SKILL.md +277 -381
  38. package/pipeline/skills/shared/external/authentication/evals/evals.json +25 -25
  39. package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +135 -178
  40. package/pipeline/skills/shared/external/authentication/references/passkeys.md +111 -147
  41. package/pipeline/skills/shared/external/avkit/SKILL.md +267 -364
  42. package/pipeline/skills/shared/external/avkit/evals/evals.json +26 -26
  43. package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +375 -493
  44. package/pipeline/skills/shared/external/background-processing/SKILL.md +274 -384
  45. package/pipeline/skills/shared/external/background-processing/evals/evals.json +22 -22
  46. package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +173 -321
  47. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +290 -371
  48. package/pipeline/skills/shared/external/callkit-voip/evals/evals.json +24 -24
  49. package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +175 -343
  50. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +292 -381
  51. package/pipeline/skills/shared/external/cloudkit-sync/evals/evals.json +33 -30
  52. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +227 -355
  53. package/pipeline/skills/shared/external/contacts-framework/SKILL.md +197 -346
  54. package/pipeline/skills/shared/external/contacts-framework/evals/evals.json +19 -21
  55. package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +169 -308
  56. package/pipeline/skills/shared/external/core-bluetooth/SKILL.md +228 -376
  57. package/pipeline/skills/shared/external/core-bluetooth/evals/evals.json +25 -22
  58. package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +257 -337
  59. package/pipeline/skills/shared/external/core-data/SKILL.md +302 -368
  60. package/pipeline/skills/shared/external/core-data/evals/evals.json +30 -27
  61. package/pipeline/skills/shared/external/core-motion/SKILL.md +235 -324
  62. package/pipeline/skills/shared/external/core-motion/evals/evals.json +31 -27
  63. package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +210 -310
  64. package/pipeline/skills/shared/external/core-nfc/SKILL.md +292 -366
  65. package/pipeline/skills/shared/external/core-nfc/evals/evals.json +22 -24
  66. package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +233 -329
  67. package/pipeline/skills/shared/external/coreml/SKILL.md +323 -367
  68. package/pipeline/skills/shared/external/coreml/evals/evals.json +24 -21
  69. package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +562 -565
  70. package/pipeline/skills/shared/external/cryptokit/SKILL.md +253 -394
  71. package/pipeline/skills/shared/external/cryptokit/evals/evals.json +20 -18
  72. package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +299 -488
  73. package/pipeline/skills/shared/external/debugging-instruments/SKILL.md +270 -323
  74. package/pipeline/skills/shared/external/debugging-instruments/evals/evals.json +27 -30
  75. package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +167 -315
  76. package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +140 -193
  77. package/pipeline/skills/shared/external/device-integrity/SKILL.md +236 -353
  78. package/pipeline/skills/shared/external/device-integrity/evals/evals.json +25 -21
  79. package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +159 -197
  80. package/pipeline/skills/shared/external/energykit/SKILL.md +225 -392
  81. package/pipeline/skills/shared/external/energykit/evals/evals.json +29 -28
  82. package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +174 -470
  83. package/pipeline/skills/shared/external/eventkit-calendar/SKILL.md +261 -383
  84. package/pipeline/skills/shared/external/eventkit-calendar/evals/evals.json +25 -22
  85. package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +165 -268
  86. package/pipeline/skills/shared/external/healthkit/SKILL.md +252 -303
  87. package/pipeline/skills/shared/external/healthkit/evals/evals.json +24 -23
  88. package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +369 -523
  89. package/pipeline/skills/shared/external/homekit-matter/SKILL.md +233 -348
  90. package/pipeline/skills/shared/external/homekit-matter/evals/evals.json +27 -22
  91. package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +199 -305
  92. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +368 -340
  93. package/pipeline/skills/shared/external/ios-accessibility/evals/evals.json +28 -27
  94. package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +314 -260
  95. package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +97 -67
  96. package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +165 -101
  97. package/pipeline/skills/shared/external/ios-localization/SKILL.md +258 -371
  98. package/pipeline/skills/shared/external/ios-localization/evals/evals.json +23 -23
  99. package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +283 -491
  100. package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +313 -440
  101. package/pipeline/skills/shared/external/ios-networking/SKILL.md +265 -341
  102. package/pipeline/skills/shared/external/ios-networking/evals/evals.json +24 -24
  103. package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +425 -652
  104. package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +143 -285
  105. package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +93 -53
  106. package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +231 -456
  107. package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +517 -784
  108. package/pipeline/skills/shared/external/ios-simulator/SKILL.md +265 -393
  109. package/pipeline/skills/shared/external/ios-simulator/evals/evals.json +21 -21
  110. package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +177 -270
  111. package/pipeline/skills/shared/external/live-activities/SKILL.md +318 -360
  112. package/pipeline/skills/shared/external/live-activities/evals/evals.json +21 -21
  113. package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +478 -710
  114. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +3 -3
  115. package/pipeline/skills/shared/external/localization-reuse-map/example-mapping.json +1 -1
  116. package/pipeline/skills/shared/external/localization-reuse-map/reference/format-and-output.md +8 -7
  117. package/pipeline/skills/shared/external/localization-reuse-map/reference/publish-and-snapshot.md +2 -2
  118. package/pipeline/skills/shared/external/localization-reuse-map/reference/sources-and-recipes.md +5 -2
  119. package/pipeline/skills/shared/external/localization-reuse-map/scripts/_shared.py +100 -0
  120. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-artifact.py +45 -26
  121. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-spreadsheet.py +14 -16
  122. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-annotations.py +12 -5
  123. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-legacy-labels.py +2 -1
  124. package/pipeline/skills/shared/external/localization-reuse-map/scripts/publish-confluence.py +6 -5
  125. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-overlay.py +44 -18
  126. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-legacy-values.py +5 -2
  127. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-new-values.py +10 -11
  128. package/pipeline/skills/shared/external/localization-reuse-map/scripts/scan-screen-keys.py +4 -33
  129. package/pipeline/skills/shared/external/localization-reuse-map/scripts/verify-map.py +12 -59
  130. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +297 -267
  131. package/pipeline/skills/shared/external/mapkit-location/evals/evals.json +28 -24
  132. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +378 -532
  133. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +397 -499
  134. package/pipeline/skills/shared/external/metrickit-diagnostics/SKILL.md +165 -348
  135. package/pipeline/skills/shared/external/metrickit-diagnostics/evals/evals.json +26 -23
  136. package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +123 -130
  137. package/pipeline/skills/shared/external/musickit-audio/SKILL.md +189 -315
  138. package/pipeline/skills/shared/external/musickit-audio/evals/evals.json +22 -21
  139. package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +181 -270
  140. package/pipeline/skills/shared/external/natural-language/SKILL.md +188 -340
  141. package/pipeline/skills/shared/external/natural-language/evals/evals.json +21 -21
  142. package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +171 -225
  143. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +258 -392
  144. package/pipeline/skills/shared/external/passkit-wallet/evals/evals.json +30 -29
  145. package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +164 -231
  146. package/pipeline/skills/shared/external/pdfkit/SKILL.md +312 -344
  147. package/pipeline/skills/shared/external/pdfkit/evals/evals.json +19 -19
  148. package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +413 -624
  149. package/pipeline/skills/shared/external/pencilkit-drawing/SKILL.md +242 -358
  150. package/pipeline/skills/shared/external/pencilkit-drawing/evals/evals.json +25 -21
  151. package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +161 -226
  152. package/pipeline/skills/shared/external/permissionkit/SKILL.md +282 -400
  153. package/pipeline/skills/shared/external/permissionkit/evals/evals.json +27 -30
  154. package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +237 -350
  155. package/pipeline/skills/shared/external/photos-camera-media/SKILL.md +276 -325
  156. package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +299 -545
  157. package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +344 -588
  158. package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +316 -660
  159. package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +270 -416
  160. package/pipeline/skills/shared/external/push-notifications/SKILL.md +312 -340
  161. package/pipeline/skills/shared/external/push-notifications/evals/evals.json +27 -26
  162. package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +328 -485
  163. package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +327 -560
  164. package/pipeline/skills/shared/external/realitykit-ar/SKILL.md +218 -410
  165. package/pipeline/skills/shared/external/realitykit-ar/evals/evals.json +24 -27
  166. package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +221 -348
  167. package/pipeline/skills/shared/external/shareplay-activities/SKILL.md +222 -393
  168. package/pipeline/skills/shared/external/shareplay-activities/evals/evals.json +23 -24
  169. package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +280 -420
  170. package/pipeline/skills/shared/external/skill-creator/template.md +7 -1
  171. package/pipeline/skills/shared/external/speech-recognition/SKILL.md +217 -421
  172. package/pipeline/skills/shared/external/speech-recognition/evals/evals.json +23 -26
  173. package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +133 -125
  174. package/pipeline/skills/shared/external/storekit/SKILL.md +228 -204
  175. package/pipeline/skills/shared/external/storekit/evals/evals.json +27 -24
  176. package/pipeline/skills/shared/external/storekit/references/app-review-guidelines.md +98 -109
  177. package/pipeline/skills/shared/external/storekit/references/core-patterns.md +302 -241
  178. package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +356 -649
  179. package/pipeline/skills/shared/external/swift-api-design-guidelines/SKILL.md +274 -399
  180. package/pipeline/skills/shared/external/swift-api-design-guidelines/evals/evals.json +22 -24
  181. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +107 -108
  182. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +93 -165
  183. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +99 -137
  184. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +77 -120
  185. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +334 -350
  186. package/pipeline/skills/shared/external/swift-architecture/evals/evals.json +22 -22
  187. package/pipeline/skills/shared/external/swift-charts/SKILL.md +208 -394
  188. package/pipeline/skills/shared/external/swift-charts/evals/evals.json +27 -30
  189. package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +351 -762
  190. package/pipeline/skills/shared/external/swift-codable/SKILL.md +339 -343
  191. package/pipeline/skills/shared/external/swift-codable/evals/evals.json +20 -20
  192. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +304 -351
  193. package/pipeline/skills/shared/external/swift-concurrency/evals/evals.json +27 -24
  194. package/pipeline/skills/shared/external/swift-concurrency/references/approachable-concurrency.md +65 -80
  195. package/pipeline/skills/shared/external/swift-concurrency/references/async-algorithms.md +48 -84
  196. package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +134 -79
  197. package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +145 -167
  198. package/pipeline/skills/shared/external/swift-concurrency/references/diagnostics.md +62 -50
  199. package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +92 -121
  200. package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +177 -241
  201. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +258 -234
  202. package/pipeline/skills/shared/external/swift-language/SKILL.md +342 -382
  203. package/pipeline/skills/shared/external/swift-language/evals/evals.json +24 -27
  204. package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +79 -56
  205. package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +297 -340
  206. package/pipeline/skills/shared/external/swift-security/SKILL.md +183 -162
  207. package/pipeline/skills/shared/external/swift-security/evals/evals.json +25 -25
  208. package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +314 -469
  209. package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +411 -476
  210. package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +260 -530
  211. package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +270 -477
  212. package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +573 -571
  213. package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +370 -441
  214. package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +332 -433
  215. package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +346 -468
  216. package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +375 -491
  217. package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +431 -432
  218. package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +328 -425
  219. package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +341 -579
  220. package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +397 -457
  221. package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +354 -614
  222. package/pipeline/skills/shared/external/swift-testing/SKILL.md +191 -175
  223. package/pipeline/skills/shared/external/swift-testing/evals/evals.json +26 -24
  224. package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +81 -84
  225. package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +317 -433
  226. package/pipeline/skills/shared/external/swiftdata/SKILL.md +394 -256
  227. package/pipeline/skills/shared/external/swiftdata/evals/evals.json +24 -24
  228. package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +206 -402
  229. package/pipeline/skills/shared/external/swiftdata/references/indexing.md +59 -52
  230. package/pipeline/skills/shared/external/swiftdata/references/predicate-pitfalls.md +57 -33
  231. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +354 -747
  232. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +300 -508
  233. package/pipeline/skills/shared/external/swiftlint/SKILL.md +175 -226
  234. package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +141 -208
  235. package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +100 -109
  236. package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +159 -179
  237. package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +383 -18
  238. package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +143 -229
  239. package/pipeline/skills/shared/external/swiftui-animation/SKILL.md +283 -366
  240. package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +396 -608
  241. package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +336 -385
  242. package/pipeline/skills/shared/external/swiftui-gestures/SKILL.md +239 -349
  243. package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +228 -310
  244. package/pipeline/skills/shared/external/swiftui-layout-components/SKILL.md +260 -249
  245. package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +92 -74
  246. package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +112 -177
  247. package/pipeline/skills/shared/external/swiftui-layout-components/references/list.md +61 -64
  248. package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +94 -134
  249. package/pipeline/skills/shared/external/swiftui-liquid-glass/SKILL.md +193 -225
  250. package/pipeline/skills/shared/external/swiftui-liquid-glass/references/liquid-glass.md +173 -327
  251. package/pipeline/skills/shared/external/swiftui-navigation/SKILL.md +201 -168
  252. package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +127 -150
  253. package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +134 -133
  254. package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +152 -117
  255. package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +111 -138
  256. package/pipeline/skills/shared/external/swiftui-patterns/SKILL.md +316 -252
  257. package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +341 -332
  258. package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +547 -854
  259. package/pipeline/skills/shared/external/swiftui-patterns/references/design-polish.md +485 -537
  260. package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +417 -499
  261. package/pipeline/skills/shared/external/swiftui-performance/SKILL.md +213 -376
  262. package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +86 -175
  263. package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +89 -195
  264. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +95 -182
  265. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-improving-swiftui-performance.md +71 -149
  266. package/pipeline/skills/shared/external/swiftui-performance/references/wwdc-session-sources.md +21 -27
  267. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +303 -295
  268. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +204 -387
  269. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +469 -683
  270. package/pipeline/skills/shared/external/swiftui-webkit/SKILL.md +140 -186
  271. package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +75 -86
  272. package/pipeline/skills/shared/external/swiftui-webkit/references/local-content-and-custom-schemes.md +63 -60
  273. package/pipeline/skills/shared/external/swiftui-webkit/references/migration-and-fallbacks.md +69 -137
  274. package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +95 -67
  275. package/pipeline/skills/shared/external/tipkit/SKILL.md +220 -335
  276. package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +356 -494
  277. package/pipeline/skills/shared/external/vision-framework/SKILL.md +260 -375
  278. package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +393 -515
  279. package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +363 -539
  280. package/pipeline/skills/shared/external/weatherkit/SKILL.md +160 -315
  281. package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +288 -407
  282. package/pipeline/skills/shared/external/widgetkit/SKILL.md +224 -288
  283. package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +416 -719
  284. package/pipeline/skills/shared/external/NOTICE-swift-ios-skills.md +0 -39
@@ -1,219 +1,147 @@
1
1
  # Conventions and Special Rules
2
2
 
3
- Casing conventions, complexity documentation, free function exceptions, overload safety, and tuple/closure naming.
3
+ Casing, complexity notes, when a free function is right, safe overloading,
4
+ labelled tuples and closures, and the traps of unconstrained polymorphism.
4
5
 
5
- ## Contents
6
+ ## Casing
6
7
 
7
- - [Casing Conventions](#casing-conventions)
8
- - [Complexity Documentation](#complexity-documentation)
9
- - [Free Function Exceptions](#free-function-exceptions)
10
- - [Overload Safety](#overload-safety)
11
- - [Tuple Member and Closure Parameter Naming](#tuple-member-and-closure-parameter-naming)
12
- - [Unconstrained Polymorphism](#unconstrained-polymorphism)
8
+ `lowerCamelCase` covers functions, methods, properties, variables, constants,
9
+ enum cases and argument labels. Types and protocols use `UpperCamelCase`.
13
10
 
14
- ## Casing Conventions
11
+ Acronyms and initialisms:
15
12
 
16
- Types and protocols use `UpperCamelCase`. Everything else - functions, methods, properties, variables, constants, enum cases, argument labels - uses `lowerCamelCase`.
13
+ - At the start of a `lowerCamelCase` name, all lower case: `utf8Bytes`,
14
+ `htmlParser`, `urlSession`.
15
+ - In the middle or at the end, cased to match the position, which in practice
16
+ means all upper case: `isRepresentableAsASCII`, `userSMTPServer`.
17
+ - In type names, all upper case: `HTTPRequest`, `URLSessionTask`, `UTF8`.
18
+ - Words that began as acronyms but are now ordinary words take normal casing:
19
+ `radarDetector` / `RadarDetector`, `laserPrinter`, `scubaGear`, never
20
+ `RADARDetector`.
17
21
 
18
- ### Acronym handling
22
+ ## Complexity notes
19
23
 
20
- Acronyms that appear as all-uppercase in common American English usage are uniformly upper- or lower-cased based on their position in the name.
24
+ Document the complexity of any computed property or subscript that does more
25
+ than constant work.
21
26
 
22
27
  ```swift
23
- // At the start of a lowerCamelCase name - all lowercase
24
- var utf8Bytes: [UTF8.CodeUnit]
25
- var htmlParser: HTMLParser
26
- var urlSession: URLSession
27
-
28
- // In the middle or end - follows the case of its position
29
- var isRepresentableAsASCII = true
30
- var userSMTPServer: SMTPServer
31
-
32
- // Type names - acronym stays uppercase
33
- struct HTTPRequest { ... }
34
- class URLSessionTask { ... }
35
- enum UTF8 { ... }
36
- ```
37
-
38
- Words that started as acronyms but are now common words follow standard casing:
39
-
40
- ```swift
41
- // These are words, not acronyms
42
- var radarDetector: RadarDetector // not "RADARDetector"
43
- var laserPrinter: LaserPrinter // not "LASERPrinter"
44
- var scubaGear: ScubaGear // not "SCUBAGear"
45
- ```
46
-
47
- ## Complexity Documentation
48
-
49
- Callers assume computed properties are O(1). Document the complexity of any computed property or subscript that does more work.
50
-
51
- ```swift
52
- /// The total number of nodes in the tree.
53
- ///
54
- /// - Complexity: O(*n*), where *n* is the number of nodes.
55
- var nodeCount: Int {
56
- root.descendants.count
28
+ extension Outline {
29
+ /// The number of headings at every depth.
30
+ ///
31
+ /// - Complexity: O(*n*), where *n* is the number of headings in the outline.
32
+ var headingCount: Int {
33
+ children.reduce(1) { $0 + $1.headingCount }
34
+ }
57
35
  }
58
- ```
59
36
 
60
- ```swift
61
- /// The element at the given offset from the start.
62
- ///
63
- /// - Complexity: O(*k*), where *k* is the offset.
64
- subscript(offset: Int) -> Element {
65
- var current = startIndex
66
- for _ in 0..<offset { current = index(after: current) }
67
- return self[current]
37
+ extension Playlist {
38
+ /// Accesses the track `offset` positions after the start.
39
+ ///
40
+ /// - Complexity: O(*k*), where *k* is `offset`; tracks are walked with
41
+ /// `index(after:)`.
42
+ subscript(offset offset: Int) -> Track {
43
+ var position = tracks.startIndex
44
+ for _ in 0..<offset { position = tracks.index(after: position) }
45
+ return tracks[position]
46
+ }
68
47
  }
69
48
  ```
70
49
 
71
- Properties that are genuinely O(1) do not need a complexity note - the default assumption is correct.
50
+ Members that really are O(1), such as a stored `count`, `isEmpty` or `first`,
51
+ need no note.
72
52
 
73
- ```swift
74
- // O(1) - no note needed
75
- var count: Int { storage.count }
76
- var isEmpty: Bool { count == 0 }
77
- var first: Element? { storage.first }
78
- ```
79
-
80
- ## Free Function Exceptions
81
-
82
- Prefer methods and properties to free functions. Use a free function only when one of these three conditions holds:
83
-
84
- **1. No obvious `self`**
53
+ ## Free functions
85
54
 
86
- ```swift
87
- // GOOD - neither argument is more "self" than the other
88
- min(x, y)
89
- max(a, b)
90
- zip(sequence1, sequence2)
91
- ```
92
-
93
- **2. Unconstrained generic**
94
-
95
- ```swift
96
- // GOOD - works on anything
97
- print(value)
98
- debugPrint(value)
99
- ```
55
+ Make it a method unless one of three exceptions applies:
100
56
 
101
- **3. Established domain notation**
57
+ | Exception | Examples |
58
+ |---|---|
59
+ | No obvious `self` | `min`, `max`, `zip` |
60
+ | Unconstrained generic | `print`, `debugPrint` |
61
+ | Established domain notation | `sin`, `cos`, `abs` |
102
62
 
103
63
  ```swift
104
- // GOOD - mathematical convention
105
- sin(x)
106
- cos(x)
107
- abs(value)
64
+ let d = origin.distance(to: target) // method
65
+ // not: calculateDistance(from: origin, to: target)
108
66
  ```
109
67
 
110
- If none of these apply, make it a method.
111
-
112
- ```swift
113
- // BAD - has an obvious self
114
- calculateDistance(from: pointA, to: pointB)
115
-
116
- // GOOD
117
- pointA.distance(to: pointB)
118
- ```
68
+ ## Overloads
119
69
 
120
- ## Overload Safety
70
+ Sharing a base name is fine when the operations are the same idea with
71
+ different inputs, as with `contains(_:)` and `contains(where:)` on
72
+ `Collection`.
121
73
 
122
- Methods may share a base name when they operate in different type domains or when their meaning is clear from context.
74
+ Overloading on the return type alone is not:
123
75
 
124
76
  ```swift
125
- // GOOD - different parameter types, same semantic operation
126
- extension Collection {
127
- func contains(_ element: Element) -> Bool
128
- func contains(where predicate: (Element) -> Bool) -> Bool
77
+ protocol ConfigReader {
78
+ func parse() -> Int
79
+ func parse() -> String
129
80
  }
130
- ```
131
81
 
132
- ### Avoid return-type-only overloads
133
-
134
- Overloads that differ only in return type create ambiguity when the compiler cannot infer the expected type.
135
-
136
- ```swift
137
- // BAD - ambiguous at call site
138
- func transform() -> Int { ... }
139
- func transform() -> String { ... }
140
-
141
- let result = transform() // error: ambiguous
82
+ let result = reader.parse() // ambiguous: which one?
142
83
  ```
143
84
 
144
- ### Safe overloading patterns
85
+ Overloads that stay unambiguous differ in their first label or in their
86
+ argument types:
145
87
 
146
88
  ```swift
147
- // GOOD - different first argument labels disambiguate
148
- func fetch(id: Int) -> User
149
- func fetch(name: String) -> User
89
+ protocol AlbumStore {
90
+ func load(id: Album.ID) async throws -> Album
91
+ func load(title: String) async throws -> Album
92
+ }
150
93
 
151
- // GOOD - different argument types
152
- func draw(_ rect: CGRect)
153
- func draw(_ path: CGPath)
94
+ protocol Canvas {
95
+ func stroke(_ rect: CGRect)
96
+ func stroke(_ path: CGPath)
97
+ }
154
98
  ```
155
99
 
156
- ## Tuple Member and Closure Parameter Naming
157
-
158
- Label tuple members and closure parameters in public API signatures. Positional access (`.0`, `.1`) is fragile and unreadable.
100
+ ## Tuples and closures
159
101
 
160
- ### Tuple members
102
+ Label tuple members and closure parameters in public signatures. `.0` and `.1`
103
+ are fragile and say nothing.
161
104
 
162
105
  ```swift
163
- // GOOD - labeled
164
- func position() -> (x: Double, y: Double)
165
- func range() -> (lower: Int, upper: Int)
166
-
167
- let pos = item.position()
168
- pos.x // clear
169
- pos.y // clear
170
-
171
- // BAD - unlabeled
172
- func position() -> (Double, Double)
173
-
174
- let pos = item.position()
175
- pos.0 // what is this?
176
- pos.1 // what is this?
106
+ protocol Chart {
107
+ func bounds() -> (min: Double, max: Double) // good
108
+ func span() -> (start: Date, end: Date) // good
109
+ func extent() -> (Double, Double) // avoid: which is which?
110
+ }
177
111
  ```
178
112
 
179
- ### Closure parameters
113
+ Closure parameters in higher-order APIs deserve descriptive names too; they
114
+ show up in documentation and completion:
180
115
 
181
- Name closure parameters where they appear in the API, especially for higher-order functions.
116
+ - `filter(_ isIncluded: (Element) throws -> Bool)`
117
+ - `map<T>(_ transform: (Element) throws -> T)`
118
+ - `sort(by areInIncreasingOrder: (Element, Element) throws -> Bool)`
182
119
 
183
- ```swift
184
- // GOOD
185
- func filter(_ isIncluded: (Element) -> Bool) -> [Element]
186
- func map<T>(_ transform: (Element) -> T) -> [T]
187
- func sort(by areInIncreasingOrder: (Element, Element) -> Bool)
188
-
189
- // BAD
190
- func filter(_ predicate: (Element) -> Bool) -> [Element] // acceptable but less descriptive
191
- func sort(by compare: (Element, Element) -> Bool) // "compare" is vague
192
- ```
120
+ `predicate` is acceptable but says less than `isIncluded`; `compare` is vague
121
+ about which order counts as true.
193
122
 
194
- ## Unconstrained Polymorphism
123
+ ## Unconstrained polymorphism
195
124
 
196
- Be careful with overloads involving `Any`, `AnyObject`, or unconstrained generics. They can silently match when a more specific overload was intended.
125
+ Overloads that take `Any`, `AnyObject` or an unconstrained generic can match
126
+ calls meant for a more specific overload, silently.
197
127
 
198
128
  ```swift
199
- // DANGEROUS - both overloads match array literals
200
- struct Container {
201
- func append(_ element: Element)
202
- func append(_ sequence: some Sequence<Element>)
129
+ struct Batch<Element> {
130
+ private(set) var items: [Element] = []
131
+
132
+ mutating func append(_ element: Element) { items.append(element) }
133
+ mutating func append(_ elements: some Sequence<Element>) { items.append(contentsOf: elements) }
203
134
  }
204
135
 
205
- values.append([2, 3, 4]) // which overload? ambiguous if Element is Array
136
+ var mixed = Batch<Any>()
137
+ mixed.append([1, 2, 3]) // compiles, but is that one new element or three?
138
+ // Both overloads accept it; nothing at the call site says which ran.
206
139
  ```
207
140
 
208
- Resolve with distinct argument labels:
141
+ Give the collection form its own label:
209
142
 
210
143
  ```swift
211
- // GOOD - unambiguous
212
- struct Container {
213
- func append(_ element: Element)
214
- func append(contentsOf sequence: some Sequence<Element>)
144
+ mutating func append(contentsOf elements: some Sequence<Element>) {
145
+ items.append(contentsOf: elements)
215
146
  }
216
-
217
- values.append(singleValue)
218
- values.append(contentsOf: [2, 3, 4]) // always clear
219
147
  ```
@@ -1,184 +1,146 @@
1
1
  # Naming and Clarity
2
2
 
3
- Extended examples for name selection, role-based naming, weak-type compensation, and terminology.
3
+ How to decide which words a name needs, which it can lose, and how to choose
4
+ between a method and a property.
4
5
 
5
- ## Contents
6
+ ## Words that must stay
6
7
 
7
- - [Include Words Needed for Clarity](#include-words-needed-for-clarity)
8
- - [Omit Needless Words](#omit-needless-words)
9
- - [Name by Role Not Type](#name-by-role-not-type)
10
- - [Compensate for Weak Type Information](#compensate-for-weak-type-information)
11
- - [Terminology Selection](#terminology-selection)
8
+ Test every call site: would a reader who has never seen the declaration know
9
+ what it does?
12
10
 
13
- ## Include Words Needed for Clarity
11
+ | Clear | Ambiguous | What the extra word resolves |
12
+ |---|---|---|
13
+ | `cache.removeValue(forKey: k)` | `cache.remove(k)` | is `k` a key or a value? |
14
+ | `team.member(for: badgeID)` | `team.member(badgeID)` | what the argument identifies |
15
+ | `label.fade(from: previousColor)` | `label.fade(previousColor)` | is it the start or the end colour? |
14
16
 
15
- If omitting a word makes the call site ambiguous, keep it. The test: can a reader unfamiliar with the declaration understand the call site?
17
+ ## Words that can go
16
18
 
17
- ```swift
18
- // GOOD - "for" distinguishes key lookup from index lookup
19
- dictionary.removeValue(forKey: key)
20
-
21
- // BAD - is key the value or the lookup key?
22
- dictionary.remove(key)
23
- ```
24
-
25
- ```swift
26
- // GOOD - "for" clarifies the relationship
27
- extension List {
28
- func member(for key: Key) -> Value?
29
- }
30
-
31
- // BAD - what is "key" relative to the list?
32
- extension List {
33
- func member(_ key: Key) -> Value?
34
- }
35
- ```
19
+ A word earns its place only if it adds something the types and context do not
20
+ already say.
36
21
 
37
- ```swift
38
- // GOOD - preposition clarifies direction
39
- view.fade(from: previousColor)
22
+ | Lean | Redundant |
23
+ |---|---|
24
+ | `toolbar.remove(cancelButton)` | `toolbar.removeElement(cancelButton)` |
25
+ | `parser.parse(data)` | `parser.parseData(data)` |
26
+ | `sprite.move(to point: CGPoint)` | `sprite.moveToPoint(_ point: CGPoint)` |
40
27
 
41
- // BAD - is this the target or the source?
42
- view.fade(previousColor)
43
- ```
28
+ ## Roles, not types
44
29
 
45
- ## Omit Needless Words
30
+ Variables, parameters and associated types should say what part they play,
31
+ not what type they happen to be.
46
32
 
47
- Remove words that merely restate type information. Every word in a name should convey information not already available.
33
+ | Role name | Type name |
34
+ |---|---|
35
+ | `var greeting: String` | `var string: String` |
36
+ | `var bodyText: String` | `var text: String` |
37
+ | `var widthConstraint: NSLayoutConstraint` | `var constraint: NSLayoutConstraint` |
38
+ | `func restock(from supplier: Warehouse)` | `func restock(from warehouse: Warehouse)` |
48
39
 
49
- ```swift
50
- // GOOD
51
- allViews.remove(cancelButton)
52
-
53
- // BAD - "Element" repeats the type constraint
54
- allViews.removeElement(cancelButton)
55
- ```
56
-
57
- ```swift
58
- // GOOD
59
- let result = parser.parse(data)
60
-
61
- // BAD - "Data" is already the parameter type
62
- let result = parser.parseData(data)
63
- ```
40
+ Associated types follow the same rule; name them for their meaning in the
41
+ protocol:
64
42
 
65
43
  ```swift
66
- // GOOD
67
- func move(to point: CGPoint)
68
-
69
- // BAD - "point" is already in the type
70
- func moveToPoint(_ point: CGPoint)
44
+ protocol Ledger {
45
+ associatedtype Entry // good: the role in a ledger
46
+ associatedtype Index // good
47
+ }
48
+ // Avoid associatedtype names such as EntryType or IntegerIndex.
71
49
  ```
72
50
 
73
- ## Name by Role Not Type
51
+ ## Generic parameters
74
52
 
75
- Variables, parameters, and associated types should describe the entity's role in the current context.
53
+ Generic parameters are named by role as well. When the parameter means
54
+ something in the API, say it: `Element`, `Key`, `Value`, `Base`, `Destination`.
76
55
 
77
56
  ```swift
78
- // GOOD - describes the role
79
- var greeting: String
80
- var bodyText: String
81
- let widthConstraint: NSLayoutConstraint
82
- func restock(from supplier: Warehouse)
83
-
84
- // BAD - describes the type
85
- var string: String
86
- var text: String
87
- let constraint: NSLayoutConstraint
88
- func restock(from warehouse: Warehouse)
89
- ```
90
-
91
- For associated types in protocols, name by the role in the protocol's semantics:
92
-
93
- ```swift
94
- // GOOD
95
- protocol Container {
96
- associatedtype Element
97
- associatedtype Index
57
+ struct Pair<First, Second> {
58
+ var first: First
59
+ var second: Second
98
60
  }
99
61
 
100
- // BAD - names the constraint, not the role
101
- protocol Container {
102
- associatedtype ItemType
103
- associatedtype IntegerIndex
62
+ protocol Journal {
63
+ associatedtype Entry
64
+ mutating func merge<Source: Sequence>(_ source: Source) where Source.Element == Entry
104
65
  }
105
66
  ```
106
67
 
107
- ## Compensate for Weak Type Information
108
-
109
- When a parameter type is `Any`, `AnyObject`, `NSObject`, or a fundamental type (`Int`, `String`, `Double`), the call site may lack enough context to convey meaning. Add clarifying words to the name.
68
+ Reach for a single letter (`T`, `U`) only when the parameter has no role worth
69
+ naming, as in a fully generic utility:
110
70
 
111
71
  ```swift
112
- // GOOD - role words compensate for weak types
113
- func addObserver(_ observer: NSObject, forKeyPath path: String)
114
- func fill(with color: UIColor, alpha: Double)
115
- func setTag(_ tag: Int, for view: UIView)
116
-
117
- // BAD - weak types make the call site opaque
118
- func add(_ object: NSObject, for string: String)
119
- func fill(with any: UIColor, _ value: Double)
120
- func set(_ value: Int, for object: UIView)
72
+ func swapValues<T>(_ a: inout T, _ b: inout T) { (a, b) = (b, a) }
121
73
  ```
122
74
 
123
- For function return types, the same principle applies:
124
-
125
- ```swift
126
- // GOOD - return context clarifies weak type
127
- func maximumScore() -> Int
128
- func playerName() -> String
75
+ Generic parameter names are `UpperCamelCase`, like other types.
129
76
 
130
- // BAD - generic return with no context
131
- func value() -> Int
132
- func name() -> String
133
- ```
77
+ ## Weak types need help
134
78
 
135
- ## Terminology Selection
79
+ Some types carry almost no meaning on their own: `Any`, `AnyObject`,
80
+ `NSObject`, and fundamentals such as `Int`, `String` and `Double`. When a
81
+ parameter has one of these types, add a word that states its role.
136
82
 
137
- ### Prefer common words over obscure terms
83
+ | Clear | Unclear |
84
+ |---|---|
85
+ | `addObserver(_ observer: NSObject, forKeyPath path: String)` | `add(_ object: NSObject, for string: String)` |
86
+ | `fill(with color: Color, alpha: Double)` | `fill(with any: Any, _ value: Double)` |
87
+ | `setTag(_ tag: Int, for view: UIView)` | `set(_ value: Int, for object: UIView)` |
138
88
 
139
- Use a common English word when it works. Reserve terms of art for situations where the precise technical meaning matters and no common word captures it.
89
+ The same goes for return values:
140
90
 
141
91
  ```swift
142
- // GOOD - common word suffices
143
- skin // not "epidermis"
144
- beginners // not "neophytes"
145
-
146
- // GOOD - term of art is precise and necessary
147
- func sin(_ angle: Double) -> Double // "sine" is the term of art
92
+ func highestScore() -> Int // not value() -> Int
93
+ func captainName() -> String // not name() -> String
148
94
  ```
149
95
 
150
- ### Preserve established meanings
96
+ ## Method or property
151
97
 
152
- Never use a term of art with a non-standard meaning. Anyone who knows the term expects its conventional definition.
98
+ Properties read as facts about the receiver, and callers treat them as free.
99
+ Choose a property when all of these hold:
153
100
 
154
- ```swift
155
- // GOOD - Array is the established term
156
- struct Array<Element> { ... }
157
-
158
- // BAD - "List" means something different in CS (linked list)
159
- struct List<Element> { ... } // if it's really an array
160
- ```
101
+ - no arguments;
102
+ - no observable side effects;
103
+ - cannot throw or suspend;
104
+ - O(1), or its complexity is documented.
161
105
 
162
- ### Avoid abbreviations
106
+ Choose a method when any of these hold:
163
107
 
164
- Do not abbreviate unless the abbreviation is universally understood in the domain. Spell words out.
108
+ - it needs input;
109
+ - it changes state (then it is also a mutating verb);
110
+ - it can fail or must `await`;
111
+ - the cost is large enough that a property would invite misuse, for example
112
+ a network fetch or a full scan of a large store.
165
113
 
166
114
  ```swift
167
- // GOOD
168
- var backgroundColor: UIColor
169
- var characterIndex: Int
115
+ struct Inventory {
116
+ private(set) var items: [Item]
170
117
 
171
- // BAD
172
- var bgColor: UIColor
173
- var charIdx: Int
174
- ```
118
+ var isEmpty: Bool { items.isEmpty } // O(1) fact
119
+ var itemCount: Int { items.count } // O(1) fact
175
120
 
176
- ### Embrace precedent
121
+ /// The total stock value.
122
+ ///
123
+ /// - Complexity: O(*n*), where *n* is the number of items.
124
+ var totalValue: Decimal { items.reduce(0) { $0 + $1.price } } // O(n), documented
177
125
 
178
- Follow naming conventions already established in the ecosystem, even if they conflict with a "purer" design.
126
+ func items(in category: Category) -> [Item] { // takes input
127
+ items.filter { $0.category == category }
128
+ }
179
129
 
180
- ```swift
181
- // GOOD - matches existing Swift/Cocoa convention
182
- Array, Dictionary, Set // not Vector, Map, HashSet
183
- sin(x), cos(x) // not sine(x), cosine(x)
130
+ mutating func restock(_ item: Item) { items.append(item) } // changes state
131
+ }
184
132
  ```
133
+
134
+ ## Choosing terms
135
+
136
+ - **Common words first.** Say "skin", not "epidermis"; "beginners", not
137
+ "neophytes". Keep terms of art for places where their precision matters,
138
+ such as `sin(_:)`.
139
+ - **Never bend a term of art.** If you use one, use its accepted meaning. An
140
+ array-backed type should not be called `List`, because readers will expect
141
+ a linked list.
142
+ - **Avoid abbreviations** unless everyone in the domain uses them:
143
+ `backgroundColor` and `characterIndex`, not `bgColor` and `charIdx`.
144
+ - **Follow precedent**, even over a design that seems purer. Swift says
145
+ `Array`, `Dictionary` and `Set`, not `Vector`, `Map` and `HashSet`; `sin` and
146
+ `cos`, not `sine` and `cosine`.