@mmerterden/multi-agent-pipeline 20.6.0 → 20.8.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 (326) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +0 -10
  3. package/docs/facts.json +1 -1
  4. package/manifest.json +328 -329
  5. package/package.json +2 -2
  6. package/pipeline/multi-agent-refs/features/design-conformance.md +62 -64
  7. package/pipeline/scripts/_notices.mjs +12 -1
  8. package/pipeline/scripts/gen-skills-index.mjs +1 -1
  9. package/pipeline/skills/.skill-manifest.json +106 -106
  10. package/pipeline/skills/shared/README.md +71 -71
  11. package/pipeline/skills/shared/external/agent-introspection-debugging/SKILL.md +1 -0
  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/android-architecture/SKILL.md +2 -0
  16. package/pipeline/skills/shared/external/android-performance/SKILL.md +2 -0
  17. package/pipeline/skills/shared/external/android-security/SKILL.md +2 -0
  18. package/pipeline/skills/shared/external/app-clips/SKILL.md +260 -160
  19. package/pipeline/skills/shared/external/app-clips/evals/evals.json +27 -27
  20. package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +150 -83
  21. package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +135 -83
  22. package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +143 -85
  23. package/pipeline/skills/shared/external/app-intents/SKILL.md +302 -304
  24. package/pipeline/skills/shared/external/app-intents/evals/evals.json +21 -21
  25. package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +594 -894
  26. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +339 -277
  27. package/pipeline/skills/shared/external/app-store-optimization/evals/evals.json +27 -23
  28. package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +105 -122
  29. package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +143 -166
  30. package/pipeline/skills/shared/external/app-store-review/SKILL.md +307 -326
  31. package/pipeline/skills/shared/external/app-store-review/evals/evals.json +21 -21
  32. package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +105 -67
  33. package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +114 -101
  34. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +333 -360
  35. package/pipeline/skills/shared/external/apple-on-device-ai/evals/evals.json +24 -27
  36. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +215 -322
  37. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +161 -256
  38. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +277 -387
  39. package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +196 -210
  40. package/pipeline/skills/shared/external/authentication/SKILL.md +265 -381
  41. package/pipeline/skills/shared/external/authentication/evals/evals.json +25 -25
  42. package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +133 -178
  43. package/pipeline/skills/shared/external/authentication/references/passkeys.md +111 -147
  44. package/pipeline/skills/shared/external/avkit/SKILL.md +267 -364
  45. package/pipeline/skills/shared/external/avkit/evals/evals.json +26 -26
  46. package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +375 -493
  47. package/pipeline/skills/shared/external/background-processing/SKILL.md +270 -382
  48. package/pipeline/skills/shared/external/background-processing/evals/evals.json +22 -22
  49. package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +169 -317
  50. package/pipeline/skills/shared/external/backlog/BACKLOG.md +1 -1
  51. package/pipeline/skills/shared/external/backlog/SKILL.md +56 -33
  52. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +290 -371
  53. package/pipeline/skills/shared/external/callkit-voip/evals/evals.json +24 -24
  54. package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +175 -343
  55. package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +1 -0
  56. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +292 -381
  57. package/pipeline/skills/shared/external/cloudkit-sync/evals/evals.json +33 -30
  58. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +227 -355
  59. package/pipeline/skills/shared/external/compose-components/SKILL.md +2 -0
  60. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +3 -2
  61. package/pipeline/skills/shared/external/compose-testing/SKILL.md +2 -0
  62. package/pipeline/skills/shared/external/contacts-framework/SKILL.md +197 -346
  63. package/pipeline/skills/shared/external/contacts-framework/evals/evals.json +19 -21
  64. package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +169 -308
  65. package/pipeline/skills/shared/external/core-bluetooth/SKILL.md +226 -376
  66. package/pipeline/skills/shared/external/core-bluetooth/evals/evals.json +25 -22
  67. package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +257 -337
  68. package/pipeline/skills/shared/external/core-data/SKILL.md +292 -368
  69. package/pipeline/skills/shared/external/core-data/evals/evals.json +30 -27
  70. package/pipeline/skills/shared/external/core-motion/SKILL.md +235 -324
  71. package/pipeline/skills/shared/external/core-motion/evals/evals.json +31 -27
  72. package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +210 -310
  73. package/pipeline/skills/shared/external/core-nfc/SKILL.md +292 -366
  74. package/pipeline/skills/shared/external/core-nfc/evals/evals.json +22 -24
  75. package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +233 -329
  76. package/pipeline/skills/shared/external/coreml/SKILL.md +323 -367
  77. package/pipeline/skills/shared/external/coreml/evals/evals.json +24 -21
  78. package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +562 -565
  79. package/pipeline/skills/shared/external/council/SKILL.md +1 -0
  80. package/pipeline/skills/shared/external/cryptokit/SKILL.md +253 -394
  81. package/pipeline/skills/shared/external/cryptokit/evals/evals.json +20 -18
  82. package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +299 -488
  83. package/pipeline/skills/shared/external/css-modern/SKILL.md +1 -0
  84. package/pipeline/skills/shared/external/database-patterns/SKILL.md +1 -0
  85. package/pipeline/skills/shared/external/debugging-instruments/SKILL.md +270 -323
  86. package/pipeline/skills/shared/external/debugging-instruments/evals/evals.json +27 -30
  87. package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +167 -315
  88. package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +140 -193
  89. package/pipeline/skills/shared/external/device-integrity/SKILL.md +230 -353
  90. package/pipeline/skills/shared/external/device-integrity/evals/evals.json +25 -21
  91. package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +159 -197
  92. package/pipeline/skills/shared/external/energykit/SKILL.md +225 -392
  93. package/pipeline/skills/shared/external/energykit/evals/evals.json +29 -28
  94. package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +174 -470
  95. package/pipeline/skills/shared/external/eventkit-calendar/SKILL.md +261 -383
  96. package/pipeline/skills/shared/external/eventkit-calendar/evals/evals.json +25 -22
  97. package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +165 -268
  98. package/pipeline/skills/shared/external/evidence-github/SKILL.md +2 -0
  99. package/pipeline/skills/shared/external/evidence-registry/SKILL.md +2 -0
  100. package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +2 -0
  101. package/pipeline/skills/shared/external/healthkit/SKILL.md +252 -303
  102. package/pipeline/skills/shared/external/healthkit/evals/evals.json +24 -23
  103. package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +369 -523
  104. package/pipeline/skills/shared/external/homekit-matter/SKILL.md +233 -348
  105. package/pipeline/skills/shared/external/homekit-matter/evals/evals.json +27 -22
  106. package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +199 -305
  107. package/pipeline/skills/shared/external/html-semantic/SKILL.md +1 -0
  108. package/pipeline/skills/shared/external/humanizer/SKILL.md +1 -0
  109. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +368 -340
  110. package/pipeline/skills/shared/external/ios-accessibility/evals/evals.json +28 -27
  111. package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +314 -260
  112. package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +97 -67
  113. package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +165 -101
  114. package/pipeline/skills/shared/external/ios-coding-standard/SKILL.md +1 -0
  115. package/pipeline/skills/shared/external/ios-localization/SKILL.md +258 -371
  116. package/pipeline/skills/shared/external/ios-localization/evals/evals.json +23 -23
  117. package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +283 -491
  118. package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +313 -440
  119. package/pipeline/skills/shared/external/ios-module-structure/SKILL.md +1 -0
  120. package/pipeline/skills/shared/external/ios-networking/SKILL.md +265 -341
  121. package/pipeline/skills/shared/external/ios-networking/evals/evals.json +24 -24
  122. package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +425 -652
  123. package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +143 -285
  124. package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +93 -53
  125. package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +231 -456
  126. package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +517 -784
  127. package/pipeline/skills/shared/external/ios-security/SKILL.md +2 -0
  128. package/pipeline/skills/shared/external/ios-simulator/SKILL.md +265 -393
  129. package/pipeline/skills/shared/external/ios-simulator/evals/evals.json +21 -21
  130. package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +177 -270
  131. package/pipeline/skills/shared/external/live-activities/SKILL.md +318 -360
  132. package/pipeline/skills/shared/external/live-activities/evals/evals.json +21 -21
  133. package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +478 -710
  134. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +91 -283
  135. package/pipeline/skills/shared/external/localization-reuse-map/reference/format-and-output.md +119 -151
  136. package/pipeline/skills/shared/external/localization-reuse-map/reference/publish-and-snapshot.md +60 -90
  137. package/pipeline/skills/shared/external/localization-reuse-map/reference/sources-and-recipes.md +119 -156
  138. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-artifact.py +726 -787
  139. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-spreadsheet.py +253 -288
  140. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-annotations.py +243 -304
  141. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-legacy-labels.py +88 -104
  142. package/pipeline/skills/shared/external/localization-reuse-map/scripts/publish-confluence.py +181 -235
  143. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-key-shots.py +198 -263
  144. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-overlay.py +461 -466
  145. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-legacy-values.py +145 -151
  146. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-new-values.py +123 -141
  147. package/pipeline/skills/shared/external/localization-reuse-map/scripts/scan-screen-keys.py +146 -157
  148. package/pipeline/skills/shared/external/localization-reuse-map/scripts/snapshot-resources.sh +22 -19
  149. package/pipeline/skills/shared/external/localization-reuse-map/scripts/verify-map.py +156 -140
  150. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +295 -267
  151. package/pipeline/skills/shared/external/mapkit-location/evals/evals.json +28 -24
  152. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +378 -532
  153. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +397 -499
  154. package/pipeline/skills/shared/external/metrickit-diagnostics/SKILL.md +165 -348
  155. package/pipeline/skills/shared/external/metrickit-diagnostics/evals/evals.json +26 -23
  156. package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +123 -130
  157. package/pipeline/skills/shared/external/musickit-audio/SKILL.md +189 -315
  158. package/pipeline/skills/shared/external/musickit-audio/evals/evals.json +22 -21
  159. package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +181 -270
  160. package/pipeline/skills/shared/external/natural-language/SKILL.md +188 -340
  161. package/pipeline/skills/shared/external/natural-language/evals/evals.json +21 -21
  162. package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +171 -225
  163. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +1 -0
  164. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +258 -392
  165. package/pipeline/skills/shared/external/passkit-wallet/evals/evals.json +30 -29
  166. package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +164 -231
  167. package/pipeline/skills/shared/external/pdfkit/SKILL.md +312 -344
  168. package/pipeline/skills/shared/external/pdfkit/evals/evals.json +19 -19
  169. package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +413 -624
  170. package/pipeline/skills/shared/external/pencilkit-drawing/SKILL.md +242 -358
  171. package/pipeline/skills/shared/external/pencilkit-drawing/evals/evals.json +25 -21
  172. package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +161 -226
  173. package/pipeline/skills/shared/external/permissionkit/SKILL.md +282 -400
  174. package/pipeline/skills/shared/external/permissionkit/evals/evals.json +27 -30
  175. package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +237 -350
  176. package/pipeline/skills/shared/external/photos-camera-media/SKILL.md +276 -325
  177. package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +299 -545
  178. package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +344 -588
  179. package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +316 -660
  180. package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +270 -416
  181. package/pipeline/skills/shared/external/play-store-review/SKILL.md +2 -0
  182. package/pipeline/skills/shared/external/push-notifications/SKILL.md +312 -340
  183. package/pipeline/skills/shared/external/push-notifications/evals/evals.json +27 -26
  184. package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +328 -485
  185. package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +327 -560
  186. package/pipeline/skills/shared/external/python-patterns/SKILL.md +1 -0
  187. package/pipeline/skills/shared/external/react-best-practices/SKILL.md +1 -0
  188. package/pipeline/skills/shared/external/realitykit-ar/SKILL.md +218 -410
  189. package/pipeline/skills/shared/external/realitykit-ar/evals/evals.json +24 -27
  190. package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +221 -348
  191. package/pipeline/skills/shared/external/rest-api-design/SKILL.md +1 -0
  192. package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +2 -0
  193. package/pipeline/skills/shared/external/room-database/SKILL.md +2 -0
  194. package/pipeline/skills/shared/external/search-first/SKILL.md +1 -0
  195. package/pipeline/skills/shared/external/shareplay-activities/SKILL.md +222 -393
  196. package/pipeline/skills/shared/external/shareplay-activities/evals/evals.json +23 -24
  197. package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +280 -420
  198. package/pipeline/skills/shared/external/signal-community/SKILL.md +2 -0
  199. package/pipeline/skills/shared/external/skill-creator/SKILL.md +80 -41
  200. package/pipeline/skills/shared/external/skill-creator/audit.md +63 -59
  201. package/pipeline/skills/shared/external/skill-creator/checklist.md +28 -20
  202. package/pipeline/skills/shared/external/skill-creator/examples.md +40 -40
  203. package/pipeline/skills/shared/external/skill-creator/label-check.md +48 -36
  204. package/pipeline/skills/shared/external/skill-creator/scripts/audit-panel.js +91 -100
  205. package/pipeline/skills/shared/external/skill-creator/template.md +51 -39
  206. package/pipeline/skills/shared/external/speech-recognition/SKILL.md +217 -421
  207. package/pipeline/skills/shared/external/speech-recognition/evals/evals.json +23 -26
  208. package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +133 -125
  209. package/pipeline/skills/shared/external/storekit/SKILL.md +228 -204
  210. package/pipeline/skills/shared/external/storekit/evals/evals.json +27 -24
  211. package/pipeline/skills/shared/external/storekit/references/app-review-guidelines.md +98 -109
  212. package/pipeline/skills/shared/external/storekit/references/core-patterns.md +298 -242
  213. package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +356 -649
  214. package/pipeline/skills/shared/external/swift-api-design-guidelines/SKILL.md +274 -399
  215. package/pipeline/skills/shared/external/swift-api-design-guidelines/evals/evals.json +22 -24
  216. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +107 -108
  217. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +93 -165
  218. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +99 -137
  219. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +77 -120
  220. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +334 -350
  221. package/pipeline/skills/shared/external/swift-architecture/evals/evals.json +22 -22
  222. package/pipeline/skills/shared/external/swift-charts/SKILL.md +208 -394
  223. package/pipeline/skills/shared/external/swift-charts/evals/evals.json +27 -30
  224. package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +351 -762
  225. package/pipeline/skills/shared/external/swift-codable/SKILL.md +339 -343
  226. package/pipeline/skills/shared/external/swift-codable/evals/evals.json +20 -20
  227. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +303 -351
  228. package/pipeline/skills/shared/external/swift-concurrency/evals/evals.json +27 -24
  229. package/pipeline/skills/shared/external/swift-concurrency/references/approachable-concurrency.md +65 -80
  230. package/pipeline/skills/shared/external/swift-concurrency/references/async-algorithms.md +48 -84
  231. package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +134 -79
  232. package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +145 -167
  233. package/pipeline/skills/shared/external/swift-concurrency/references/diagnostics.md +62 -50
  234. package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +92 -121
  235. package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +177 -241
  236. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +258 -234
  237. package/pipeline/skills/shared/external/swift-language/SKILL.md +342 -382
  238. package/pipeline/skills/shared/external/swift-language/evals/evals.json +24 -27
  239. package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +79 -56
  240. package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +297 -340
  241. package/pipeline/skills/shared/external/swift-security/SKILL.md +180 -161
  242. package/pipeline/skills/shared/external/swift-security/evals/evals.json +25 -25
  243. package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +314 -469
  244. package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +408 -476
  245. package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +260 -530
  246. package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +270 -477
  247. package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +573 -571
  248. package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +370 -441
  249. package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +332 -433
  250. package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +346 -468
  251. package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +352 -472
  252. package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +431 -432
  253. package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +328 -425
  254. package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +341 -579
  255. package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +396 -457
  256. package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +354 -614
  257. package/pipeline/skills/shared/external/swift-testing/SKILL.md +188 -175
  258. package/pipeline/skills/shared/external/swift-testing/evals/evals.json +26 -24
  259. package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +80 -84
  260. package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +317 -433
  261. package/pipeline/skills/shared/external/swiftdata/SKILL.md +392 -256
  262. package/pipeline/skills/shared/external/swiftdata/evals/evals.json +24 -24
  263. package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +206 -402
  264. package/pipeline/skills/shared/external/swiftdata/references/indexing.md +59 -52
  265. package/pipeline/skills/shared/external/swiftdata/references/predicate-pitfalls.md +57 -33
  266. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +354 -747
  267. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +300 -508
  268. package/pipeline/skills/shared/external/swiftlint/SKILL.md +175 -226
  269. package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +141 -208
  270. package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +100 -109
  271. package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +159 -179
  272. package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +383 -18
  273. package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +143 -229
  274. package/pipeline/skills/shared/external/swiftui-animation/SKILL.md +283 -366
  275. package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +396 -608
  276. package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +336 -385
  277. package/pipeline/skills/shared/external/swiftui-gestures/SKILL.md +239 -349
  278. package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +228 -310
  279. package/pipeline/skills/shared/external/swiftui-layout-components/SKILL.md +260 -249
  280. package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +92 -74
  281. package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +112 -177
  282. package/pipeline/skills/shared/external/swiftui-layout-components/references/list.md +61 -64
  283. package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +94 -134
  284. package/pipeline/skills/shared/external/swiftui-liquid-glass/SKILL.md +193 -225
  285. package/pipeline/skills/shared/external/swiftui-liquid-glass/references/liquid-glass.md +173 -327
  286. package/pipeline/skills/shared/external/swiftui-navigation/SKILL.md +193 -168
  287. package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +127 -150
  288. package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +132 -133
  289. package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +152 -117
  290. package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +106 -140
  291. package/pipeline/skills/shared/external/swiftui-patterns/SKILL.md +316 -252
  292. package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +341 -332
  293. package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +547 -854
  294. package/pipeline/skills/shared/external/swiftui-patterns/references/design-polish.md +485 -537
  295. package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +417 -499
  296. package/pipeline/skills/shared/external/swiftui-performance/SKILL.md +213 -376
  297. package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +86 -175
  298. package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +89 -195
  299. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +95 -182
  300. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-improving-swiftui-performance.md +71 -149
  301. package/pipeline/skills/shared/external/swiftui-performance/references/wwdc-session-sources.md +21 -27
  302. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +303 -295
  303. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +204 -387
  304. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +469 -683
  305. package/pipeline/skills/shared/external/swiftui-webkit/SKILL.md +140 -186
  306. package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +75 -86
  307. package/pipeline/skills/shared/external/swiftui-webkit/references/local-content-and-custom-schemes.md +63 -60
  308. package/pipeline/skills/shared/external/swiftui-webkit/references/migration-and-fallbacks.md +69 -137
  309. package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +95 -67
  310. package/pipeline/skills/shared/external/tailwind-css/SKILL.md +1 -0
  311. package/pipeline/skills/shared/external/testing-backend/SKILL.md +1 -0
  312. package/pipeline/skills/shared/external/tipkit/SKILL.md +220 -335
  313. package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +356 -494
  314. package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +1 -0
  315. package/pipeline/skills/shared/external/vision-framework/SKILL.md +260 -375
  316. package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +393 -515
  317. package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +363 -539
  318. package/pipeline/skills/shared/external/vue-composition/SKILL.md +1 -0
  319. package/pipeline/skills/shared/external/weatherkit/SKILL.md +152 -310
  320. package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +288 -407
  321. package/pipeline/skills/shared/external/web-accessibility/SKILL.md +1 -0
  322. package/pipeline/skills/shared/external/web-performance/SKILL.md +1 -0
  323. package/pipeline/skills/shared/external/web-testing/SKILL.md +1 -0
  324. package/pipeline/skills/shared/external/widgetkit/SKILL.md +216 -288
  325. package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +414 -719
  326. package/pipeline/skills/shared/external/NOTICE-swift-ios-skills.md +0 -39
@@ -1,480 +1,353 @@
1
- # RealityKit + ARKit Extended Patterns
1
+ # RealityKit Patterns
2
2
 
3
- Overflow reference for the `realitykit` skill. Contains advanced patterns that exceed the main skill file's scope.
3
+ Longer examples for the `realitykit-ar` skill. SKILL.md covers setup, anchoring,
4
+ raycasting and gestures; this file goes deeper.
4
5
 
5
6
  ## Contents
6
7
 
7
- - [Physics Simulation](#physics-simulation)
8
- - [Entity Animations](#entity-animations)
9
- - [Custom Materials and Lighting](#custom-materials-and-lighting)
10
- - [Entity Component System](#entity-component-system)
11
- - [Occlusion and Environment](#occlusion-and-environment)
12
- - [RealityKit + SwiftUI Integration](#realitykit--swiftui-integration)
13
- - [Performance Tips](#performance-tips)
8
+ - [Physics](#physics)
9
+ - [Animation](#animation)
10
+ - [Materials and lighting](#materials-and-lighting)
11
+ - [Custom components and systems](#custom-components-and-systems)
12
+ - [Occlusion and environment](#occlusion-and-environment)
13
+ - [A SwiftUI model viewer](#a-swiftui-model-viewer)
14
+ - [Entity accessibility](#entity-accessibility)
15
+ - [Performance](#performance)
14
16
 
15
- ## Physics Simulation
17
+ ## Physics
16
18
 
17
- ### Rigid Body Physics
19
+ A static floor and a bouncing ball:
18
20
 
19
21
  ```swift
20
- import RealityKit
21
-
22
- func createPhysicsScene(content: RealityViewCameraContent) {
23
- // Ground plane (static body)
24
- let ground = ModelEntity(
25
- mesh: .generatePlane(width: 2, depth: 2),
26
- materials: [SimpleMaterial(color: .gray, isMetallic: false)]
27
- )
28
- ground.components.set(PhysicsBodyComponent(
29
- massProperties: .default,
30
- material: .default,
31
- mode: .static
32
- ))
33
- ground.components.set(CollisionComponent(
34
- shapes: [.generateBox(size: [2, 0.01, 2])]
35
- ))
36
- ground.position = [0, -0.5, -1]
37
- content.add(ground)
38
-
39
- // Falling box (dynamic body)
40
- let box = ModelEntity(
41
- mesh: .generateBox(size: 0.1),
42
- materials: [SimpleMaterial(color: .red, isMetallic: true)]
43
- )
44
- box.components.set(PhysicsBodyComponent(
45
- massProperties: .init(mass: 1.0),
46
- material: PhysicsMaterialResource.generate(
47
- staticFriction: 0.5,
48
- dynamicFriction: 0.5,
49
- restitution: 0.7
50
- ),
51
- mode: .dynamic
52
- ))
53
- box.components.set(CollisionComponent(
54
- shapes: [.generateBox(size: [0.1, 0.1, 0.1])]
55
- ))
56
- box.position = [0, 0.5, -1]
57
- content.add(box)
22
+ @MainActor
23
+ func makeCourt() -> (floor: ModelEntity, ball: ModelEntity) {
24
+ let floor = ModelEntity(mesh: .generatePlane(width: 3, depth: 3))
25
+ floor.components.set(PhysicsBodyComponent(massProperties: .default, material: .default, mode: .static))
26
+ floor.components.set(CollisionComponent(shapes: [.generateBox(size: [3, 0.005, 3])]))
27
+
28
+ let bounce = PhysicsMaterialResource.generate(staticFriction: 0.4, dynamicFriction: 0.3, restitution: 0.8)
29
+ let ball = ModelEntity(mesh: .generateSphere(radius: 0.05))
30
+ ball.components.set(PhysicsBodyComponent(massProperties: .init(mass: 0.6), material: bounce, mode: .dynamic))
31
+ ball.components.set(CollisionComponent(shapes: [.generateSphere(radius: 0.05)]))
32
+ ball.position = [0, 1, 0]
33
+ return (floor, ball)
58
34
  }
59
35
  ```
60
36
 
61
- ### Applying Forces and Impulses
37
+ Entities with a physics body conform to `HasPhysicsBody`, which adds:
62
38
 
63
- ```swift
64
- // Apply a continuous force (in Newtons)
65
- if var physics = entity.components[PhysicsBodyComponent.self] {
66
- // Forces are applied per-frame via the physics simulation
67
- }
39
+ - `addForce(_:relativeTo:)`: a continuous force in newtons, applied each frame
40
+ you call it.
41
+ - `applyLinearImpulse(_:relativeTo:)`: an instant kick.
68
42
 
69
- // Apply an instantaneous impulse
70
- if let physicsEntity = entity as? HasPhysicsBody {
71
- physicsEntity.addForce([0, 10, 0], relativeTo: nil)
72
- physicsEntity.applyLinearImpulse([5, 0, 0], relativeTo: nil)
43
+ ```swift
44
+ @MainActor
45
+ func kick(_ ball: ModelEntity) {
46
+ ball.applyLinearImpulse([0.3, 1.2, 0], relativeTo: nil)
73
47
  }
74
48
  ```
75
49
 
76
- ### Collision Detection
50
+ Collision events:
77
51
 
78
52
  ```swift
79
53
  RealityView { content in
80
- // Setup entities...
81
-
82
- _ = content.subscribe(to: CollisionEvents.Began.self) { event in
83
- print("Collision between \(event.entityA.name) and \(event.entityB.name)")
54
+ let court = makeCourt()
55
+ content.add(court.floor)
56
+ content.add(court.ball)
57
+ _ = content.subscribe(to: CollisionEvents.Began.self) { contact in
58
+ Log.scene.debug("\(contact.entityA.name) touched \(contact.entityB.name)")
84
59
  }
85
-
86
- _ = content.subscribe(to: CollisionEvents.Ended.self) { event in
87
- print("Collision ended between \(event.entityA.name) and \(event.entityB.name)")
60
+ _ = content.subscribe(to: CollisionEvents.Ended.self) { contact in
61
+ Log.scene.debug("\(contact.entityA.name) separated")
88
62
  }
89
63
  }
90
64
  ```
91
65
 
92
- ## Entity Animations
66
+ ## Animation
93
67
 
94
- ### Transform Animation
68
+ Move an entity by animating to a changed copy of its transform:
95
69
 
96
70
  ```swift
97
- func animateEntity(_ entity: Entity) {
98
- // Move to a new position over 2 seconds
99
- var transform = entity.transform
100
- transform.translation = [0.5, 0, -0.5]
101
-
102
- entity.move(
103
- to: transform,
104
- relativeTo: entity.parent,
105
- duration: 2.0,
106
- timingFunction: .easeInOut
107
- )
71
+ @MainActor
72
+ func slideUp(_ panel: Entity) {
73
+ var target = panel.transform
74
+ target.translation.y += 0.2
75
+ panel.move(to: target, relativeTo: panel.parent, duration: 0.8, timingFunction: .easeInOut)
108
76
  }
109
77
  ```
110
78
 
111
- ### Orbit Animation
79
+ Circle an entity around a point with a per-frame subscription:
112
80
 
113
81
  ```swift
114
- func orbitAnimation(
115
- entity: Entity,
116
- content: RealityViewCameraContent
117
- ) {
82
+ RealityView { content in
83
+ let moon = ModelEntity(mesh: .generateSphere(radius: 0.02))
84
+ content.add(moon)
85
+ let center: SIMD3<Float> = [0, 0, -0.7]
118
86
  var angle: Float = 0
119
- let radius: Float = 0.3
120
- let center = SIMD3<Float>(0, 0, -0.8)
121
-
122
- _ = content.subscribe(to: SceneEvents.Update.self) { event in
123
- angle += Float(event.deltaTime) * 1.5
124
- entity.position = center + SIMD3<Float>(
125
- cos(angle) * radius,
126
- 0,
127
- sin(angle) * radius
128
- )
87
+ _ = content.subscribe(to: SceneEvents.Update.self) { frame in
88
+ angle += Float(frame.deltaTime) * 0.9
89
+ moon.position = center + [0.25 * cos(angle), 0, 0.25 * sin(angle)]
129
90
  }
130
91
  }
131
92
  ```
132
93
 
133
- ### Playing USDZ Animations
94
+ Play an animation baked into a USDZ file:
134
95
 
135
96
  ```swift
136
- RealityView { content in
137
- if let character = try? await ModelEntity(named: "character") {
138
- content.add(character)
139
-
140
- // Play all available animations
141
- if let animation = character.availableAnimations.first {
142
- character.playAnimation(
143
- animation.repeat(duration: .infinity),
144
- transitionDuration: 0.5,
145
- startsPaused: false
146
- )
147
- }
148
- }
97
+ @MainActor
98
+ func startIdleLoop(on robot: Entity) {
99
+ guard let clip = robot.availableAnimations.first else { return }
100
+ robot.playAnimation(clip.repeat(duration: .infinity), transitionDuration: 0.4, startsPaused: false)
149
101
  }
150
102
  ```
151
103
 
152
- ## Custom Materials and Lighting
153
-
154
- ### SimpleMaterial Variations
104
+ ## Materials and lighting
155
105
 
156
106
  ```swift
157
- // Metallic material
158
- let metallic = SimpleMaterial(
159
- color: .init(tint: .gray, texture: nil),
160
- roughness: .float(0.1),
161
- isMetallic: true
162
- )
163
-
164
- // Transparent material
165
- var transparent = SimpleMaterial()
166
- transparent.color = .init(
167
- tint: UIColor.blue.withAlphaComponent(0.5),
168
- texture: nil
169
- )
170
- transparent.blending = .transparent(opacity: 0.5)
171
-
172
- // Textured material
173
- if let texture = try? await TextureResource(named: "wood") {
174
- var textured = SimpleMaterial()
175
- textured.color = .init(
176
- tint: .white,
177
- texture: .init(texture)
178
- )
107
+ @MainActor
108
+ func chrome() -> SimpleMaterial {
109
+ SimpleMaterial(color: .lightGray, roughness: .float(0.05), isMetallic: true)
179
110
  }
180
- ```
181
111
 
182
- ### Environment Lighting
112
+ @MainActor
113
+ func frostedGlass() -> PhysicallyBasedMaterial {
114
+ var glass = PhysicallyBasedMaterial()
115
+ glass.baseColor = .init(tint: .white)
116
+ glass.roughness = 0.3
117
+ glass.blending = .transparent(opacity: 0.5)
118
+ return glass
119
+ }
183
120
 
184
- ```swift
185
- RealityView { content in
186
- // Use image-based lighting
187
- if let resource = try? await EnvironmentResource(named: "studio") {
188
- content.environment.lighting.resource = resource
189
- content.environment.lighting.intensityExponent = 1.0
121
+ @MainActor
122
+ func woodGrain() async -> SimpleMaterial {
123
+ var wood = SimpleMaterial()
124
+ if let grain = try? await TextureResource(named: "oak_diffuse") {
125
+ wood.color = .init(tint: .white, texture: .init(grain))
190
126
  }
127
+ return wood
191
128
  }
192
129
  ```
193
130
 
194
- ## Entity Component System
195
-
196
- ### Custom Components
131
+ `SimpleMaterial` has no `blending` property; transparency needs
132
+ `PhysicallyBasedMaterial` or `UnlitMaterial`.
197
133
 
198
- Define custom components to attach data to entities:
134
+ Image-based lighting from an environment resource: put an
135
+ `ImageBasedLightComponent` on one entity and point each lit entity at it with
136
+ `ImageBasedLightReceiverComponent`. `RealityViewCameraContent.environment` has
137
+ no lighting properties on iOS.
199
138
 
200
139
  ```swift
201
- import RealityKit
202
-
203
- struct HealthComponent: Component {
204
- var currentHealth: Float
205
- var maxHealth: Float
206
-
207
- var healthPercentage: Float {
208
- currentHealth / maxHealth
209
- }
140
+ RealityView { content in
141
+ guard let studio = try? await EnvironmentResource(named: "softbox") else { return }
142
+ let light = Entity()
143
+ light.components.set(ImageBasedLightComponent(source: .single(studio), intensityExponent: 1.2))
144
+ content.add(light)
145
+
146
+ let vase = ModelEntity(mesh: .generateSphere(radius: 0.1), materials: [chrome()])
147
+ vase.components.set(ImageBasedLightReceiverComponent(imageBasedLight: light))
148
+ content.add(vase)
210
149
  }
211
-
212
- // Register the component (once, at app launch)
213
- HealthComponent.registerComponent()
214
-
215
- // Attach to an entity
216
- let enemy = ModelEntity(
217
- mesh: .generateBox(size: 0.1),
218
- materials: [SimpleMaterial(color: .red, isMetallic: false)]
219
- )
220
- enemy.components.set(HealthComponent(
221
- currentHealth: 100,
222
- maxHealth: 100
223
- ))
224
150
  ```
225
151
 
226
- ### Custom Systems
227
-
228
- Systems process entities with matching components each frame:
152
+ ## Custom components and systems
229
153
 
230
154
  ```swift
231
- struct HealthColorSystem: System {
232
- static let query = EntityQuery(where: .has(HealthComponent.self))
155
+ struct Hover: Component {
156
+ var height: Float = 0.03
157
+ var speed: Float = 2
158
+ var phase: Float = 0
159
+ var offset: Float { sin(phase) * height }
160
+ }
233
161
 
234
- init(scene: Scene) { }
162
+ struct HoverSystem: System {
163
+ static let query = EntityQuery(where: .has(Hover.self))
164
+
165
+ init(scene: RealityKit.Scene) {}
235
166
 
236
167
  func update(context: SceneUpdateContext) {
237
- for entity in context.entities(
238
- matching: Self.query,
239
- updatingSystemWhen: .rendering
240
- ) {
241
- guard let health = entity.components[HealthComponent.self],
242
- var model = entity.components[ModelComponent.self]
243
- else { continue }
244
-
245
- let ratio = health.healthPercentage
246
- let color = UIColor(
247
- red: CGFloat(1 - ratio),
248
- green: CGFloat(ratio),
249
- blue: 0,
250
- alpha: 1
251
- )
252
- model.materials = [SimpleMaterial(
253
- color: color,
254
- isMetallic: false
255
- )]
256
- entity.components.set(model)
168
+ for entity in context.entities(matching: Self.query, updatingSystemWhen: .rendering) {
169
+ guard var hover = entity.components[Hover.self] else { continue }
170
+ hover.phase += hover.speed * Float(context.deltaTime)
171
+ entity.position.y = hover.offset
172
+ entity.components[Hover.self] = hover
173
+
174
+ if var model = entity.components[ModelComponent.self], hover.offset > 0 {
175
+ model.materials = [SimpleMaterial(color: .systemYellow, isMetallic: false)]
176
+ entity.components[ModelComponent.self] = model
177
+ }
257
178
  }
258
179
  }
259
180
  }
181
+ ```
182
+
183
+ Register both once at launch, then attach the component to entities:
260
184
 
261
- // Register the system
262
- HealthColorSystem.registerSystem()
185
+ ```swift
186
+ Hover.registerComponent()
187
+ HoverSystem.registerSystem()
188
+ lantern.components.set(Hover())
263
189
  ```
264
190
 
265
- ## Occlusion and Environment
191
+ Components are value types, so read, change and write back; the same goes for
192
+ `ModelComponent`.
266
193
 
267
- ### Occlusion Material
194
+ ## Occlusion and environment
268
195
 
269
- Use occlusion materials to hide virtual content behind real-world surfaces:
196
+ An invisible occluder hides virtual objects behind a real table or wall:
270
197
 
271
198
  ```swift
272
- let occlusionPlane = ModelEntity(
273
- mesh: .generatePlane(width: 1, depth: 1),
274
- materials: [OcclusionMaterial()]
275
- )
276
- occlusionPlane.position = [0, -0.5, -1]
277
- content.add(occlusionPlane)
199
+ let tableTop = ModelEntity(mesh: .generatePlane(width: 1.2, depth: 0.7), materials: [OcclusionMaterial()])
278
200
  ```
279
201
 
280
- This makes virtual objects appear to go behind real-world surfaces.
281
-
282
- ### Environment Configuration
202
+ In AR mode the camera feed is the background. With the `.virtual` camera, the
203
+ iOS `RealityViewEnvironment` offers `.default` and `.skybox(_:)`:
283
204
 
284
205
  ```swift
285
- RealityView { content in
286
- // Configure the background
287
- content.environment.background = .color(.clear) // AR camera passthrough
288
-
289
- // Adjust lighting intensity
290
- content.environment.lighting.intensityExponent = 1.2
206
+ content.camera = .virtual
207
+ if let sky = try? await EnvironmentResource(named: "softbox") {
208
+ content.environment = .skybox(sky)
291
209
  }
292
210
  ```
293
211
 
294
- ## RealityKit + SwiftUI Integration
295
-
296
- ### AR Model Viewer with Controls
212
+ ## A SwiftUI model viewer
297
213
 
298
214
  ```swift
299
- import SwiftUI
300
- import RealityKit
301
215
  import AVFoundation
216
+ import Observation
217
+ import RealityKit
218
+ import SwiftUI
302
219
 
303
- @Observable
304
- @MainActor
305
- final class ARViewModel {
306
- var selectedModelName: String = "robot"
307
- var modelScale: Float = 0.01
308
- var isPlaced = false
309
-
310
- private var currentEntity: ModelEntity?
311
-
312
- func loadModel(into content: RealityViewCameraContent) async {
313
- // Remove existing model
314
- currentEntity?.removeFromParent()
315
-
316
- guard let model = try? await ModelEntity(
317
- named: selectedModelName
318
- ) else { return }
319
-
320
- model.scale = [modelScale, modelScale, modelScale]
321
- model.position = [0, -0.2, -0.8]
322
- model.name = "currentModel"
323
-
324
- // Enable interaction
325
- model.generateCollisionShapes(recursive: true)
326
- model.components.set(InputTargetComponent())
327
-
328
- content.add(model)
329
- currentEntity = model
330
- isPlaced = true
220
+ @Observable @MainActor
221
+ final class ShowroomModel {
222
+ var selection = "chair"
223
+ var scale: Float = 0.01
224
+ private var current: ModelEntity?
225
+
226
+ func show(in content: RealityViewCameraContent) async {
227
+ current?.removeFromParent()
228
+ guard let piece = try? await ModelEntity(named: selection) else { return }
229
+ piece.name = "showpiece"
230
+ piece.scale = SIMD3(repeating: scale)
231
+ piece.position = [0, -0.1, -0.6]
232
+ piece.generateCollisionShapes(recursive: true)
233
+ piece.components.set(InputTargetComponent())
234
+ content.add(piece)
235
+ current = piece
331
236
  }
332
237
  }
333
238
 
334
- struct ARModelViewer: View {
335
- @State private var viewModel = ARViewModel()
336
- @State private var cameraAuthorized = false
239
+ struct ShowroomView: View {
240
+ @State private var model = ShowroomModel()
241
+ @State private var cameraAllowed = false
337
242
 
338
243
  var body: some View {
339
- ZStack {
340
- if cameraAuthorized {
244
+ Group {
245
+ if cameraAllowed {
341
246
  RealityView { content in
342
- await viewModel.loadModel(into: content)
247
+ await model.show(in: content)
343
248
  } update: { content in
344
- if let model = content.entities.first(
345
- where: { $0.name == "currentModel" }
346
- ) {
347
- let s = viewModel.modelScale
348
- model.scale = [s, s, s]
349
- }
249
+ content.entities.first { $0.name == "showpiece" }?.scale = SIMD3(repeating: model.scale)
350
250
  }
351
251
  .gesture(
352
252
  DragGesture()
353
253
  .targetedToAnyEntity()
354
- .onChanged { value in
355
- value.entity.position = value.convert(
356
- value.location3D,
357
- from: .local,
358
- to: value.entity.parent!
359
- )
254
+ .onChanged { drag in
255
+ guard let parent = drag.entity.parent,
256
+ let point = drag.unproject(\.location, to: parent) else { return }
257
+ drag.entity.position = point
360
258
  }
361
259
  )
260
+ .overlay(alignment: .bottom) { controls }
362
261
  } else {
363
- ContentUnavailableView(
364
- "Camera Required",
365
- systemImage: "camera.fill",
366
- description: Text("Allow camera access for AR.")
367
- )
368
- }
369
-
370
- VStack {
371
- Spacer()
372
- controlsPanel
373
- }
374
- }
375
- .task {
376
- let status = AVCaptureDevice.authorizationStatus(for: .video)
377
- if status == .authorized {
378
- cameraAuthorized = true
379
- } else if status == .notDetermined {
380
- cameraAuthorized = await AVCaptureDevice
381
- .requestAccess(for: .video)
262
+ ContentUnavailableView("Camera needed", systemImage: "camera",
263
+ description: Text("Allow camera access in Settings to place furniture."))
382
264
  }
383
265
  }
266
+ .task { cameraAllowed = await cameraReady() }
384
267
  }
385
268
 
386
- private var controlsPanel: some View {
269
+ private var controls: some View {
387
270
  VStack {
388
- Picker("Model", selection: $viewModel.selectedModelName) {
389
- Text("Robot").tag("robot")
390
- Text("Chair").tag("chair")
391
- Text("Lamp").tag("lamp")
271
+ Picker("Item", selection: $model.selection) {
272
+ Text("Armchair").tag("chair")
273
+ Text("Desk lamp").tag("desk_lamp")
392
274
  }
393
275
  .pickerStyle(.segmented)
394
-
395
- Slider(
396
- value: $viewModel.modelScale,
397
- in: 0.001...0.05,
398
- step: 0.001
399
- ) {
400
- Text("Scale")
401
- }
276
+ Slider(value: $model.scale, in: 0.001...0.05, step: 0.001)
402
277
  }
403
278
  .padding()
404
- .background(.ultraThinMaterial)
405
- .clipShape(.rect(cornerRadius: 16))
279
+ .background(.ultraThinMaterial, in: .rect(cornerRadius: 20))
406
280
  .padding()
407
281
  }
408
282
  }
409
283
  ```
410
284
 
411
- ### Entity Accessibility
285
+ `cameraReady()` is the permission helper from SKILL.md. The drag handler
286
+ guards for a parent entity instead of assuming one exists.
287
+ `generateCollisionShapes(recursive: true)` together with
288
+ `InputTargetComponent()` makes a loaded model interactive.
412
289
 
413
- Make AR content accessible to assistive technologies:
290
+ ## Entity accessibility
414
291
 
415
292
  ```swift
416
- let model = ModelEntity(
417
- mesh: .generateBox(size: 0.1),
418
- materials: [SimpleMaterial(color: .blue, isMetallic: false)]
419
- )
420
- var accessibility = AccessibilityComponent()
421
- accessibility.isAccessibilityElement = true
422
- accessibility.label = "Blue cube"
423
- accessibility.value = "Interactive 3D object"
424
- accessibility.traits = [.button]
425
- accessibility.systemActions = [.activate]
426
- model.components.set(accessibility)
293
+ @MainActor
294
+ func describe(_ door: Entity) {
295
+ var info = AccessibilityComponent()
296
+ info.isAccessibilityElement = true
297
+ info.label = "Garage door"
298
+ info.value = "Closed"
299
+ info.traits = [.button]
300
+ info.systemActions = [.activate]
301
+ door.components.set(info)
302
+ }
427
303
  ```
428
304
 
429
- ## Performance Tips
430
-
431
- ### Entity Pooling
305
+ ## Performance
432
306
 
433
- Reuse entities instead of creating and destroying them repeatedly:
307
+ Keep a pool of entities and recycle them, rather than allocating fresh ones
308
+ and throwing them away:
434
309
 
435
310
  ```swift
436
311
  @MainActor
437
- final class EntityPool {
438
- private var available: [ModelEntity] = []
439
- private let mesh: MeshResource
440
- private let materials: [any Material]
441
-
442
- init(mesh: MeshResource, materials: [any Material], initialCount: Int) {
443
- self.mesh = mesh
444
- self.materials = materials
445
- for _ in 0..<initialCount {
446
- let entity = ModelEntity(mesh: mesh, materials: materials)
447
- entity.isEnabled = false
448
- available.append(entity)
312
+ final class DebrisPool {
313
+ private var idle: [ModelEntity] = []
314
+ private let mesh = MeshResource.generateBox(size: 0.02)
315
+ private let paint = [SimpleMaterial(color: .gray, isMetallic: false)]
316
+
317
+ init(size: Int) {
318
+ for _ in 0..<size {
319
+ let chip = ModelEntity(mesh: mesh, materials: paint)
320
+ chip.isEnabled = false
321
+ idle.append(chip)
449
322
  }
450
323
  }
451
324
 
452
- func acquire() -> ModelEntity {
453
- if let entity = available.popLast() {
454
- entity.isEnabled = true
455
- return entity
456
- }
457
- return ModelEntity(mesh: mesh, materials: materials)
325
+ func take() -> ModelEntity {
326
+ let chip = idle.popLast() ?? ModelEntity(mesh: mesh, materials: paint)
327
+ chip.isEnabled = true
328
+ return chip
458
329
  }
459
330
 
460
- func release(_ entity: ModelEntity) {
461
- entity.isEnabled = false
462
- entity.removeFromParent()
463
- available.append(entity)
331
+ func giveBack(_ chip: ModelEntity) {
332
+ chip.isEnabled = false
333
+ chip.removeFromParent()
334
+ idle.append(chip)
464
335
  }
465
336
  }
466
337
  ```
467
338
 
468
- ### Reducing Draw Calls
339
+ Fewer draw calls:
469
340
 
470
- - Merge static entities into a single entity when possible
471
- - Use instancing for repeated identical geometry
472
- - Limit the number of unique materials in a scene
473
- - Use LOD (level of detail) models for objects at varying distances
341
+ - Merge static entities where you can.
342
+ - Use instancing for geometry that repeats.
343
+ - Keep the number of distinct materials low.
344
+ - Swap in lower-detail models as distance grows.
474
345
 
475
- ### Memory Management
346
+ Memory:
476
347
 
477
- - Unload entities that are no longer visible
478
- - Use `ModelEntity(named:in:)` with a specific bundle to control resource loading
479
- - Monitor memory with Instruments (RealityKit Trace template)
480
- - Set `entity.isEnabled = false` instead of removing entities you will reuse
348
+ - Unload entities nobody can see.
349
+ - Load with `ModelEntity(named:in:)` and an explicit bundle to control where
350
+ resources come from.
351
+ - Profile with the RealityKit Trace template in Instruments.
352
+ - For entities you will show again, set `isEnabled = false` rather than removing
353
+ them.