@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.
- package/CHANGELOG.md +27 -0
- package/LICENSE +0 -10
- package/docs/facts.json +1 -1
- package/manifest.json +328 -329
- package/package.json +2 -2
- package/pipeline/multi-agent-refs/features/design-conformance.md +62 -64
- package/pipeline/scripts/_notices.mjs +12 -1
- package/pipeline/scripts/gen-skills-index.mjs +1 -1
- package/pipeline/skills/.skill-manifest.json +106 -106
- package/pipeline/skills/shared/README.md +71 -71
- package/pipeline/skills/shared/external/agent-introspection-debugging/SKILL.md +1 -0
- package/pipeline/skills/shared/external/alarmkit/SKILL.md +373 -381
- package/pipeline/skills/shared/external/alarmkit/evals/evals.json +23 -18
- package/pipeline/skills/shared/external/alarmkit/references/alarmkit-patterns.md +328 -378
- package/pipeline/skills/shared/external/android-architecture/SKILL.md +2 -0
- package/pipeline/skills/shared/external/android-performance/SKILL.md +2 -0
- package/pipeline/skills/shared/external/android-security/SKILL.md +2 -0
- package/pipeline/skills/shared/external/app-clips/SKILL.md +260 -160
- package/pipeline/skills/shared/external/app-clips/evals/evals.json +27 -27
- package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +150 -83
- package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +135 -83
- package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +143 -85
- package/pipeline/skills/shared/external/app-intents/SKILL.md +302 -304
- package/pipeline/skills/shared/external/app-intents/evals/evals.json +21 -21
- package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +594 -894
- package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +339 -277
- package/pipeline/skills/shared/external/app-store-optimization/evals/evals.json +27 -23
- package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +105 -122
- package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +143 -166
- package/pipeline/skills/shared/external/app-store-review/SKILL.md +307 -326
- package/pipeline/skills/shared/external/app-store-review/evals/evals.json +21 -21
- package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +105 -67
- package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +114 -101
- package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +333 -360
- package/pipeline/skills/shared/external/apple-on-device-ai/evals/evals.json +24 -27
- package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +215 -322
- package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +161 -256
- package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +277 -387
- package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +196 -210
- package/pipeline/skills/shared/external/authentication/SKILL.md +265 -381
- package/pipeline/skills/shared/external/authentication/evals/evals.json +25 -25
- package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +133 -178
- package/pipeline/skills/shared/external/authentication/references/passkeys.md +111 -147
- package/pipeline/skills/shared/external/avkit/SKILL.md +267 -364
- package/pipeline/skills/shared/external/avkit/evals/evals.json +26 -26
- package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +375 -493
- package/pipeline/skills/shared/external/background-processing/SKILL.md +270 -382
- package/pipeline/skills/shared/external/background-processing/evals/evals.json +22 -22
- package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +169 -317
- package/pipeline/skills/shared/external/backlog/BACKLOG.md +1 -1
- package/pipeline/skills/shared/external/backlog/SKILL.md +56 -33
- package/pipeline/skills/shared/external/callkit-voip/SKILL.md +290 -371
- package/pipeline/skills/shared/external/callkit-voip/evals/evals.json +24 -24
- package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +175 -343
- package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +1 -0
- package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +292 -381
- package/pipeline/skills/shared/external/cloudkit-sync/evals/evals.json +33 -30
- package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +227 -355
- package/pipeline/skills/shared/external/compose-components/SKILL.md +2 -0
- package/pipeline/skills/shared/external/compose-navigation/SKILL.md +3 -2
- package/pipeline/skills/shared/external/compose-testing/SKILL.md +2 -0
- package/pipeline/skills/shared/external/contacts-framework/SKILL.md +197 -346
- package/pipeline/skills/shared/external/contacts-framework/evals/evals.json +19 -21
- package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +169 -308
- package/pipeline/skills/shared/external/core-bluetooth/SKILL.md +226 -376
- package/pipeline/skills/shared/external/core-bluetooth/evals/evals.json +25 -22
- package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +257 -337
- package/pipeline/skills/shared/external/core-data/SKILL.md +292 -368
- package/pipeline/skills/shared/external/core-data/evals/evals.json +30 -27
- package/pipeline/skills/shared/external/core-motion/SKILL.md +235 -324
- package/pipeline/skills/shared/external/core-motion/evals/evals.json +31 -27
- package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +210 -310
- package/pipeline/skills/shared/external/core-nfc/SKILL.md +292 -366
- package/pipeline/skills/shared/external/core-nfc/evals/evals.json +22 -24
- package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +233 -329
- package/pipeline/skills/shared/external/coreml/SKILL.md +323 -367
- package/pipeline/skills/shared/external/coreml/evals/evals.json +24 -21
- package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +562 -565
- package/pipeline/skills/shared/external/council/SKILL.md +1 -0
- package/pipeline/skills/shared/external/cryptokit/SKILL.md +253 -394
- package/pipeline/skills/shared/external/cryptokit/evals/evals.json +20 -18
- package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +299 -488
- package/pipeline/skills/shared/external/css-modern/SKILL.md +1 -0
- package/pipeline/skills/shared/external/database-patterns/SKILL.md +1 -0
- package/pipeline/skills/shared/external/debugging-instruments/SKILL.md +270 -323
- package/pipeline/skills/shared/external/debugging-instruments/evals/evals.json +27 -30
- package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +167 -315
- package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +140 -193
- package/pipeline/skills/shared/external/device-integrity/SKILL.md +230 -353
- package/pipeline/skills/shared/external/device-integrity/evals/evals.json +25 -21
- package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +159 -197
- package/pipeline/skills/shared/external/energykit/SKILL.md +225 -392
- package/pipeline/skills/shared/external/energykit/evals/evals.json +29 -28
- package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +174 -470
- package/pipeline/skills/shared/external/eventkit-calendar/SKILL.md +261 -383
- package/pipeline/skills/shared/external/eventkit-calendar/evals/evals.json +25 -22
- package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +165 -268
- package/pipeline/skills/shared/external/evidence-github/SKILL.md +2 -0
- package/pipeline/skills/shared/external/evidence-registry/SKILL.md +2 -0
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +2 -0
- package/pipeline/skills/shared/external/healthkit/SKILL.md +252 -303
- package/pipeline/skills/shared/external/healthkit/evals/evals.json +24 -23
- package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +369 -523
- package/pipeline/skills/shared/external/homekit-matter/SKILL.md +233 -348
- package/pipeline/skills/shared/external/homekit-matter/evals/evals.json +27 -22
- package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +199 -305
- package/pipeline/skills/shared/external/html-semantic/SKILL.md +1 -0
- package/pipeline/skills/shared/external/humanizer/SKILL.md +1 -0
- package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +368 -340
- package/pipeline/skills/shared/external/ios-accessibility/evals/evals.json +28 -27
- package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +314 -260
- package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +97 -67
- package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +165 -101
- package/pipeline/skills/shared/external/ios-coding-standard/SKILL.md +1 -0
- package/pipeline/skills/shared/external/ios-localization/SKILL.md +258 -371
- package/pipeline/skills/shared/external/ios-localization/evals/evals.json +23 -23
- package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +283 -491
- package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +313 -440
- package/pipeline/skills/shared/external/ios-module-structure/SKILL.md +1 -0
- package/pipeline/skills/shared/external/ios-networking/SKILL.md +265 -341
- package/pipeline/skills/shared/external/ios-networking/evals/evals.json +24 -24
- package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +425 -652
- package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +143 -285
- package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +93 -53
- package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +231 -456
- package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +517 -784
- package/pipeline/skills/shared/external/ios-security/SKILL.md +2 -0
- package/pipeline/skills/shared/external/ios-simulator/SKILL.md +265 -393
- package/pipeline/skills/shared/external/ios-simulator/evals/evals.json +21 -21
- package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +177 -270
- package/pipeline/skills/shared/external/live-activities/SKILL.md +318 -360
- package/pipeline/skills/shared/external/live-activities/evals/evals.json +21 -21
- package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +478 -710
- package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +91 -283
- package/pipeline/skills/shared/external/localization-reuse-map/reference/format-and-output.md +119 -151
- package/pipeline/skills/shared/external/localization-reuse-map/reference/publish-and-snapshot.md +60 -90
- package/pipeline/skills/shared/external/localization-reuse-map/reference/sources-and-recipes.md +119 -156
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-artifact.py +726 -787
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-spreadsheet.py +253 -288
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-annotations.py +243 -304
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-legacy-labels.py +88 -104
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/publish-confluence.py +181 -235
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-key-shots.py +198 -263
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-overlay.py +461 -466
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-legacy-values.py +145 -151
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-new-values.py +123 -141
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/scan-screen-keys.py +146 -157
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/snapshot-resources.sh +22 -19
- package/pipeline/skills/shared/external/localization-reuse-map/scripts/verify-map.py +156 -140
- package/pipeline/skills/shared/external/mapkit-location/SKILL.md +295 -267
- package/pipeline/skills/shared/external/mapkit-location/evals/evals.json +28 -24
- package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +378 -532
- package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +397 -499
- package/pipeline/skills/shared/external/metrickit-diagnostics/SKILL.md +165 -348
- package/pipeline/skills/shared/external/metrickit-diagnostics/evals/evals.json +26 -23
- package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +123 -130
- package/pipeline/skills/shared/external/musickit-audio/SKILL.md +189 -315
- package/pipeline/skills/shared/external/musickit-audio/evals/evals.json +22 -21
- package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +181 -270
- package/pipeline/skills/shared/external/natural-language/SKILL.md +188 -340
- package/pipeline/skills/shared/external/natural-language/evals/evals.json +21 -21
- package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +171 -225
- package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +1 -0
- package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +258 -392
- package/pipeline/skills/shared/external/passkit-wallet/evals/evals.json +30 -29
- package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +164 -231
- package/pipeline/skills/shared/external/pdfkit/SKILL.md +312 -344
- package/pipeline/skills/shared/external/pdfkit/evals/evals.json +19 -19
- package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +413 -624
- package/pipeline/skills/shared/external/pencilkit-drawing/SKILL.md +242 -358
- package/pipeline/skills/shared/external/pencilkit-drawing/evals/evals.json +25 -21
- package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +161 -226
- package/pipeline/skills/shared/external/permissionkit/SKILL.md +282 -400
- package/pipeline/skills/shared/external/permissionkit/evals/evals.json +27 -30
- package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +237 -350
- package/pipeline/skills/shared/external/photos-camera-media/SKILL.md +276 -325
- package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +299 -545
- package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +344 -588
- package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +316 -660
- package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +270 -416
- package/pipeline/skills/shared/external/play-store-review/SKILL.md +2 -0
- package/pipeline/skills/shared/external/push-notifications/SKILL.md +312 -340
- package/pipeline/skills/shared/external/push-notifications/evals/evals.json +27 -26
- package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +328 -485
- package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +327 -560
- package/pipeline/skills/shared/external/python-patterns/SKILL.md +1 -0
- package/pipeline/skills/shared/external/react-best-practices/SKILL.md +1 -0
- package/pipeline/skills/shared/external/realitykit-ar/SKILL.md +218 -410
- package/pipeline/skills/shared/external/realitykit-ar/evals/evals.json +24 -27
- package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +221 -348
- package/pipeline/skills/shared/external/rest-api-design/SKILL.md +1 -0
- package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +2 -0
- package/pipeline/skills/shared/external/room-database/SKILL.md +2 -0
- package/pipeline/skills/shared/external/search-first/SKILL.md +1 -0
- package/pipeline/skills/shared/external/shareplay-activities/SKILL.md +222 -393
- package/pipeline/skills/shared/external/shareplay-activities/evals/evals.json +23 -24
- package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +280 -420
- package/pipeline/skills/shared/external/signal-community/SKILL.md +2 -0
- package/pipeline/skills/shared/external/skill-creator/SKILL.md +80 -41
- package/pipeline/skills/shared/external/skill-creator/audit.md +63 -59
- package/pipeline/skills/shared/external/skill-creator/checklist.md +28 -20
- package/pipeline/skills/shared/external/skill-creator/examples.md +40 -40
- package/pipeline/skills/shared/external/skill-creator/label-check.md +48 -36
- package/pipeline/skills/shared/external/skill-creator/scripts/audit-panel.js +91 -100
- package/pipeline/skills/shared/external/skill-creator/template.md +51 -39
- package/pipeline/skills/shared/external/speech-recognition/SKILL.md +217 -421
- package/pipeline/skills/shared/external/speech-recognition/evals/evals.json +23 -26
- package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +133 -125
- package/pipeline/skills/shared/external/storekit/SKILL.md +228 -204
- package/pipeline/skills/shared/external/storekit/evals/evals.json +27 -24
- package/pipeline/skills/shared/external/storekit/references/app-review-guidelines.md +98 -109
- package/pipeline/skills/shared/external/storekit/references/core-patterns.md +298 -242
- package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +356 -649
- package/pipeline/skills/shared/external/swift-api-design-guidelines/SKILL.md +274 -399
- package/pipeline/skills/shared/external/swift-api-design-guidelines/evals/evals.json +22 -24
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +107 -108
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +93 -165
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +99 -137
- package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +77 -120
- package/pipeline/skills/shared/external/swift-architecture/SKILL.md +334 -350
- package/pipeline/skills/shared/external/swift-architecture/evals/evals.json +22 -22
- package/pipeline/skills/shared/external/swift-charts/SKILL.md +208 -394
- package/pipeline/skills/shared/external/swift-charts/evals/evals.json +27 -30
- package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +351 -762
- package/pipeline/skills/shared/external/swift-codable/SKILL.md +339 -343
- package/pipeline/skills/shared/external/swift-codable/evals/evals.json +20 -20
- package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +303 -351
- package/pipeline/skills/shared/external/swift-concurrency/evals/evals.json +27 -24
- package/pipeline/skills/shared/external/swift-concurrency/references/approachable-concurrency.md +65 -80
- package/pipeline/skills/shared/external/swift-concurrency/references/async-algorithms.md +48 -84
- package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +134 -79
- package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +145 -167
- package/pipeline/skills/shared/external/swift-concurrency/references/diagnostics.md +62 -50
- package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +92 -121
- package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +177 -241
- package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +258 -234
- package/pipeline/skills/shared/external/swift-language/SKILL.md +342 -382
- package/pipeline/skills/shared/external/swift-language/evals/evals.json +24 -27
- package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +79 -56
- package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +297 -340
- package/pipeline/skills/shared/external/swift-security/SKILL.md +180 -161
- package/pipeline/skills/shared/external/swift-security/evals/evals.json +25 -25
- package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +314 -469
- package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +408 -476
- package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +260 -530
- package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +270 -477
- package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +573 -571
- package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +370 -441
- package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +332 -433
- package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +346 -468
- package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +352 -472
- package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +431 -432
- package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +328 -425
- package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +341 -579
- package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +396 -457
- package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +354 -614
- package/pipeline/skills/shared/external/swift-testing/SKILL.md +188 -175
- package/pipeline/skills/shared/external/swift-testing/evals/evals.json +26 -24
- package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +80 -84
- package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +317 -433
- package/pipeline/skills/shared/external/swiftdata/SKILL.md +392 -256
- package/pipeline/skills/shared/external/swiftdata/evals/evals.json +24 -24
- package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +206 -402
- package/pipeline/skills/shared/external/swiftdata/references/indexing.md +59 -52
- package/pipeline/skills/shared/external/swiftdata/references/predicate-pitfalls.md +57 -33
- package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +354 -747
- package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +300 -508
- package/pipeline/skills/shared/external/swiftlint/SKILL.md +175 -226
- package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +141 -208
- package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +100 -109
- package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +159 -179
- package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +383 -18
- package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +143 -229
- package/pipeline/skills/shared/external/swiftui-animation/SKILL.md +283 -366
- package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +396 -608
- package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +336 -385
- package/pipeline/skills/shared/external/swiftui-gestures/SKILL.md +239 -349
- package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +228 -310
- package/pipeline/skills/shared/external/swiftui-layout-components/SKILL.md +260 -249
- package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +92 -74
- package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +112 -177
- package/pipeline/skills/shared/external/swiftui-layout-components/references/list.md +61 -64
- package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +94 -134
- package/pipeline/skills/shared/external/swiftui-liquid-glass/SKILL.md +193 -225
- package/pipeline/skills/shared/external/swiftui-liquid-glass/references/liquid-glass.md +173 -327
- package/pipeline/skills/shared/external/swiftui-navigation/SKILL.md +193 -168
- package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +127 -150
- package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +132 -133
- package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +152 -117
- package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +106 -140
- package/pipeline/skills/shared/external/swiftui-patterns/SKILL.md +316 -252
- package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +341 -332
- package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +547 -854
- package/pipeline/skills/shared/external/swiftui-patterns/references/design-polish.md +485 -537
- package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +417 -499
- package/pipeline/skills/shared/external/swiftui-performance/SKILL.md +213 -376
- package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +86 -175
- package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +89 -195
- package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +95 -182
- package/pipeline/skills/shared/external/swiftui-performance/references/understanding-improving-swiftui-performance.md +71 -149
- package/pipeline/skills/shared/external/swiftui-performance/references/wwdc-session-sources.md +21 -27
- package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +303 -295
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +204 -387
- package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +469 -683
- package/pipeline/skills/shared/external/swiftui-webkit/SKILL.md +140 -186
- package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +75 -86
- package/pipeline/skills/shared/external/swiftui-webkit/references/local-content-and-custom-schemes.md +63 -60
- package/pipeline/skills/shared/external/swiftui-webkit/references/migration-and-fallbacks.md +69 -137
- package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +95 -67
- package/pipeline/skills/shared/external/tailwind-css/SKILL.md +1 -0
- package/pipeline/skills/shared/external/testing-backend/SKILL.md +1 -0
- package/pipeline/skills/shared/external/tipkit/SKILL.md +220 -335
- package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +356 -494
- package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +1 -0
- package/pipeline/skills/shared/external/vision-framework/SKILL.md +260 -375
- package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +393 -515
- package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +363 -539
- package/pipeline/skills/shared/external/vue-composition/SKILL.md +1 -0
- package/pipeline/skills/shared/external/weatherkit/SKILL.md +152 -310
- package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +288 -407
- package/pipeline/skills/shared/external/web-accessibility/SKILL.md +1 -0
- package/pipeline/skills/shared/external/web-performance/SKILL.md +1 -0
- package/pipeline/skills/shared/external/web-testing/SKILL.md +1 -0
- package/pipeline/skills/shared/external/widgetkit/SKILL.md +216 -288
- package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +414 -719
- package/pipeline/skills/shared/external/NOTICE-swift-ios-skills.md +0 -39
|
@@ -1,477 +1,362 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vision-framework
|
|
3
|
-
description: "
|
|
3
|
+
description: "On-device computer vision with Vision and VisionKit: OCR, face detection and landmarks, barcode and QR scanning, person and instance segmentation, object tracking, document reading and scanning, saliency, pose, Core ML inference, Swift-native (iOS 18+) and legacy VNRequest APIs, DataScannerViewController live scanning. Use when adding OCR, barcode scanning, face detection, segmentation, tracking or Core ML image inference through Vision. Not for Core ML model conversion."
|
|
4
4
|
metadata:
|
|
5
|
-
source:
|
|
5
|
+
source: multi-agent-pipeline
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Vision Framework
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
Vision finds text, faces, barcodes, objects, people and body poses in still
|
|
11
|
+
images and video frames. Everything runs on the device; no image leaves it.
|
|
12
|
+
VisionKit sits on top and supplies ready-made camera UI for live scanning and
|
|
13
|
+
document capture.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
Baseline for this skill: iOS 26 and Swift 6.3. Where an API has a lower floor
|
|
16
|
+
it is stated next to the API, so older deployment targets can still use the
|
|
17
|
+
guidance.
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Load a reference when the section below is not enough:
|
|
18
20
|
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- [Image Segmentation](#image-segmentation)
|
|
26
|
-
- [Object Tracking](#object-tracking)
|
|
27
|
-
- [Other Request Types](#other-request-types)
|
|
28
|
-
- [Core ML Integration](#core-ml-integration)
|
|
29
|
-
- [VisionKit: DataScannerViewController](#visionkit-datascannerviewcontroller)
|
|
30
|
-
- [Common Mistakes](#common-mistakes)
|
|
31
|
-
- [Review Checklist](#review-checklist)
|
|
32
|
-
- [References](#references)
|
|
21
|
+
- `references/vision-requests.md`: longer request recipes (OCR pipeline, faces,
|
|
22
|
+
barcodes, segmentation and blur, saliency, rectangles, horizon, batching,
|
|
23
|
+
camera frames, tracking, coordinate helpers, performance).
|
|
24
|
+
- `references/visionkit-scanner.md`: camera permission, `DataScannerViewController`
|
|
25
|
+
in UIKit and SwiftUI, delegate and async item streams, overlays, and
|
|
26
|
+
`VNDocumentCameraViewController` with an OCR pass.
|
|
33
27
|
|
|
34
|
-
##
|
|
28
|
+
## Choosing an API generation
|
|
35
29
|
|
|
36
|
-
Vision
|
|
30
|
+
Vision ships two parallel APIs. New code should use the Swift-native one.
|
|
37
31
|
|
|
38
|
-
| Aspect |
|
|
32
|
+
| Aspect | Swift-native API | Legacy API |
|
|
39
33
|
|---|---|---|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
34
|
+
| Availability | iOS 18, macOS 15, tvOS 18, visionOS 2 | iOS 11 and later (individual requests vary, e.g. `VNRecognizeTextRequest` is iOS 13) |
|
|
35
|
+
| Types | Swift structs such as `RecognizeTextRequest`, `DetectFaceRectanglesRequest` | Objective-C classes such as `VNRecognizeTextRequest`, `VNDetectFaceRectanglesRequest` |
|
|
36
|
+
| Running | `try await request.perform(on: image)` | `VNImageRequestHandler` plus `perform([request])` and a completion closure |
|
|
37
|
+
| Results | Typed return value (`[RecognizedTextObservation]`, `[FaceObservation]`) | `request.results` cast from a generic observation array |
|
|
38
|
+
| Geometry | `NormalizedRect` / `NormalizedPoint` with conversion helpers | `CGRect` / `CGPoint` in normalized space |
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
`TrackRectangleRequest`, `DetectTrajectoriesRequest`) are final classes.
|
|
40
|
+
Every Swift-native image request conforms to `ImageProcessingRequest`, whose
|
|
41
|
+
`perform(on:orientation:)` accepts a `CGImage`, `CIImage`, `CVPixelBuffer`,
|
|
42
|
+
`CMSampleBuffer`, image `Data` or a file `URL`. The orientation argument is
|
|
43
|
+
optional.
|
|
51
44
|
|
|
52
|
-
|
|
45
|
+
Most requests are value types. Requests that must remember earlier frames are
|
|
46
|
+
`final class` types conforming to `StatefulRequest`: `TrackObjectRequest`,
|
|
47
|
+
`TrackRectangleRequest`, `TrackOpticalFlowRequest`, `DetectTrajectoriesRequest`,
|
|
48
|
+
`DetectHumanBodyPose3DRequest` and `GeneratePersonSegmentationRequest`. Keep one
|
|
49
|
+
instance alive for the whole sequence.
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
## The request pattern
|
|
52
|
+
|
|
53
|
+
Build the request, set options, await `perform(on:)`, read typed results.
|
|
56
54
|
|
|
57
55
|
```swift
|
|
58
56
|
import Vision
|
|
59
57
|
|
|
60
|
-
func
|
|
58
|
+
func menuLines(in photo: CGImage) async throws -> [String] {
|
|
61
59
|
var request = RecognizeTextRequest()
|
|
62
60
|
request.recognitionLevel = .accurate
|
|
63
|
-
request.recognitionLanguages = [Locale.Language(identifier: "
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return observations.compactMap { observation in
|
|
67
|
-
observation.topCandidates(1).first?.string
|
|
68
|
-
}
|
|
61
|
+
request.recognitionLanguages = [Locale.Language(identifier: "it-IT")]
|
|
62
|
+
let observations = try await request.perform(on: photo)
|
|
63
|
+
return observations.compactMap { $0.topCandidates(1).first?.string }
|
|
69
64
|
}
|
|
70
65
|
```
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Use `VNImageRequestHandler` with completion-based requests when targeting
|
|
75
|
-
older deployment versions.
|
|
67
|
+
The same job with the legacy API, for deployment targets below iOS 18:
|
|
76
68
|
|
|
77
69
|
```swift
|
|
78
70
|
import Vision
|
|
79
71
|
|
|
80
|
-
func
|
|
81
|
-
var
|
|
82
|
-
let request = VNRecognizeTextRequest {
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
func legacyMenuLines(in photo: CGImage) throws -> [String] {
|
|
73
|
+
var lines: [String] = []
|
|
74
|
+
let request = VNRecognizeTextRequest { finished, _ in
|
|
75
|
+
let found = finished.results as? [VNRecognizedTextObservation] ?? []
|
|
76
|
+
lines = found.compactMap { $0.topCandidates(1).first?.string }
|
|
85
77
|
}
|
|
86
78
|
request.recognitionLevel = .accurate
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
try handler.perform([request])
|
|
90
|
-
return recognized
|
|
79
|
+
try VNImageRequestHandler(cgImage: photo).perform([request])
|
|
80
|
+
return lines
|
|
91
81
|
}
|
|
92
82
|
```
|
|
93
83
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### Modern: RecognizeTextRequest (iOS 18+)
|
|
97
|
-
|
|
98
|
-
```swift
|
|
99
|
-
var request = RecognizeTextRequest()
|
|
100
|
-
request.recognitionLevel = .accurate // .fast for real-time
|
|
101
|
-
request.recognitionLanguages = [
|
|
102
|
-
Locale.Language(identifier: "en-US"),
|
|
103
|
-
Locale.Language(identifier: "fr-FR"),
|
|
104
|
-
]
|
|
105
|
-
request.usesLanguageCorrection = true
|
|
106
|
-
request.customWords = ["SwiftUI", "Xcode"] // domain-specific terms
|
|
107
|
-
|
|
108
|
-
let observations = try await request.perform(on: cgImage)
|
|
109
|
-
for observation in observations {
|
|
110
|
-
guard let candidate = observation.topCandidates(1).first else { continue }
|
|
111
|
-
let text = candidate.string
|
|
112
|
-
let confidence = candidate.confidence // 0.0 ... 1.0
|
|
113
|
-
let bounds = observation.boundingBox // normalized coordinates
|
|
114
|
-
}
|
|
115
|
-
```
|
|
84
|
+
`VNImageRequestHandler.perform` is synchronous and calls the completion before
|
|
85
|
+
it returns, so run it on a background queue.
|
|
116
86
|
|
|
117
|
-
|
|
87
|
+
## Text recognition (OCR)
|
|
118
88
|
|
|
119
|
-
|
|
120
|
-
let request = VNRecognizeTextRequest()
|
|
121
|
-
request.recognitionLevel = .accurate
|
|
122
|
-
request.recognitionLanguages = ["en-US", "fr-FR"]
|
|
123
|
-
request.usesLanguageCorrection = true
|
|
124
|
-
```
|
|
89
|
+
`RecognizeTextRequest` (iOS 18+) options:
|
|
125
90
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
91
|
+
- `recognitionLevel`: `.accurate` for stills and offline work, `.fast` for
|
|
92
|
+
live video.
|
|
93
|
+
- `recognitionLanguages`: `[Locale.Language]`, ordered by priority.
|
|
94
|
+
- `usesLanguageCorrection`: applies language-model correction; turn it off for
|
|
95
|
+
codes, serial numbers and similar strings.
|
|
96
|
+
- `customWords`: domain vocabulary the corrector should accept.
|
|
129
97
|
|
|
130
|
-
|
|
98
|
+
Each `RecognizedTextObservation` offers `topCandidates(_:)`; a candidate
|
|
99
|
+
(`RecognizedText`) has `string` and a `confidence` from 0.0 to 1.0. The
|
|
100
|
+
observation's `boundingBox` is a `NormalizedRect`.
|
|
131
101
|
|
|
132
|
-
|
|
102
|
+
`VNRecognizeTextRequest` has the same `recognitionLevel` and
|
|
103
|
+
`usesLanguageCorrection` switches but takes languages as identifier strings
|
|
104
|
+
such as `["de-DE", "en-GB"]`. That is the practical difference: `Locale.Language`
|
|
105
|
+
values in the new API, strings in the old one.
|
|
133
106
|
|
|
134
|
-
|
|
135
|
-
// Modern API
|
|
136
|
-
let faceRequest = DetectFaceRectanglesRequest()
|
|
137
|
-
let faces = try await faceRequest.perform(on: cgImage)
|
|
138
|
-
|
|
139
|
-
for face in faces {
|
|
140
|
-
let boundingBox = face.boundingBox // normalized CGRect
|
|
141
|
-
let roll = face.roll // Measurement<UnitAngle>
|
|
142
|
-
let yaw = face.yaw // Measurement<UnitAngle>
|
|
143
|
-
}
|
|
107
|
+
## Faces
|
|
144
108
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
```
|
|
109
|
+
- `DetectFaceRectanglesRequest` returns `[FaceObservation]`. Each has a
|
|
110
|
+
`boundingBox` (`NormalizedRect`) and `roll`, `yaw` and `pitch` as
|
|
111
|
+
`Measurement<UnitAngle>`.
|
|
112
|
+
- `DetectFaceLandmarksRequest` fills the optional `landmarks`. Regions such as
|
|
113
|
+
`leftEye`, `rightEye`, `nose`, `outerLips` and `faceContour` expose `points`
|
|
114
|
+
(`[NormalizedPoint]`) and `pointsInImageCoordinates(_:origin:)`. The legacy
|
|
115
|
+
`VNFaceLandmarkRegion2D` calls the same data `normalizedPoints`.
|
|
116
|
+
- `DetectFaceCaptureQualityRequest` fills `captureQuality?.score`.
|
|
154
117
|
|
|
155
|
-
###
|
|
118
|
+
### Coordinates
|
|
156
119
|
|
|
157
|
-
Vision
|
|
158
|
-
|
|
120
|
+
Vision coordinates are normalized to 0...1 with the origin at the lower left.
|
|
121
|
+
UIKit and SwiftUI put the origin at the top left, so flip before drawing:
|
|
159
122
|
|
|
160
123
|
```swift
|
|
161
|
-
|
|
162
|
-
CGRect(
|
|
163
|
-
x: rect.origin.x,
|
|
164
|
-
y: imageHeight - rect.origin.y - rect.height,
|
|
165
|
-
width: rect.width,
|
|
166
|
-
height: rect.height
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Barcode Detection
|
|
124
|
+
import Vision
|
|
172
125
|
|
|
173
|
-
|
|
126
|
+
func overlayFrame(for face: FaceObservation, imageSize: CGSize) -> CGRect {
|
|
127
|
+
face.boundingBox.toImageCoordinates(imageSize, origin: .upperLeft)
|
|
128
|
+
}
|
|
174
129
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
let
|
|
180
|
-
|
|
181
|
-
let payload = barcode.payloadString // decoded content
|
|
182
|
-
let symbology = barcode.symbology // .qr, .ean13, etc.
|
|
183
|
-
let bounds = barcode.boundingBox // normalized rect
|
|
130
|
+
func flippedRect(_ normalized: CGRect, imageSize: CGSize) -> CGRect {
|
|
131
|
+
let w = normalized.width * imageSize.width
|
|
132
|
+
let h = normalized.height * imageSize.height
|
|
133
|
+
let x = normalized.minX * imageSize.width
|
|
134
|
+
let y = imageSize.height - normalized.minY * imageSize.height - h
|
|
135
|
+
return CGRect(x: x, y: y, width: w, height: h)
|
|
184
136
|
}
|
|
185
137
|
```
|
|
186
138
|
|
|
187
|
-
|
|
188
|
-
|
|
139
|
+
The manual version keeps x, width and height and computes
|
|
140
|
+
`y = imageHeight - originY - height`.
|
|
189
141
|
|
|
190
|
-
##
|
|
142
|
+
## Barcodes
|
|
191
143
|
|
|
192
|
-
`
|
|
193
|
-
|
|
194
|
-
|
|
144
|
+
`DetectBarcodesRequest` reads 1D and 2D codes, QR included. Set `symbologies`
|
|
145
|
+
to only what the product accepts, for example `[.qr, .pdf417, .ean13, .code128]`.
|
|
146
|
+
Each `BarcodeObservation` carries `payloadString` (decoded text, optional),
|
|
147
|
+
`symbology` and a normalized `boundingBox`. Frequently used symbologies:
|
|
148
|
+
`.qr`, `.aztec`, `.dataMatrix`, `.pdf417`, `.ean8`, `.ean13`, `.upce`,
|
|
149
|
+
`.code39`, `.code128`, `.itf14`. The full list is in
|
|
150
|
+
`references/vision-requests.md`.
|
|
195
151
|
|
|
196
|
-
|
|
197
|
-
var request = RecognizeDocumentsRequest()
|
|
198
|
-
let documents = try await request.perform(on: cgImage)
|
|
199
|
-
|
|
200
|
-
for observation in documents {
|
|
201
|
-
let container = observation.document
|
|
152
|
+
## Structured documents (iOS 26+)
|
|
202
153
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// Structured access to paragraphs
|
|
207
|
-
for paragraph in container.paragraphs {
|
|
208
|
-
let paragraphText = paragraph.text
|
|
209
|
-
}
|
|
154
|
+
`RecognizeDocumentsRequest` goes beyond line-by-line OCR and understands layout.
|
|
155
|
+
It returns `[DocumentObservation]`; `observation.document` is a
|
|
156
|
+
`DocumentObservation.Container` with:
|
|
210
157
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
158
|
+
- `text`: the whole document as a text block (`.transcript` for the string)
|
|
159
|
+
- `paragraphs`: text blocks, each with `.transcript`
|
|
160
|
+
- `tables` (rows and cells), `lists` (items), `barcodes`
|
|
161
|
+
- `title`: optional text block
|
|
214
162
|
|
|
215
|
-
|
|
216
|
-
|
|
163
|
+
```swift
|
|
164
|
+
import Vision
|
|
217
165
|
|
|
218
|
-
|
|
219
|
-
|
|
166
|
+
func invoiceParagraphs(from scan: CGImage) async throws -> [String] {
|
|
167
|
+
let request = RecognizeDocumentsRequest()
|
|
168
|
+
guard let document = try await request.perform(on: scan).first?.document else { return [] }
|
|
169
|
+
return document.paragraphs.map(\.transcript)
|
|
220
170
|
}
|
|
221
171
|
```
|
|
222
172
|
|
|
223
|
-
|
|
224
|
-
`VNDocumentCameraViewController`
|
|
225
|
-
|
|
173
|
+
When the user should photograph paper with the camera, VisionKit's
|
|
174
|
+
`VNDocumentCameraViewController` is simpler: a full-screen camera with
|
|
175
|
+
automatic capture, perspective correction and multi-page scans. See
|
|
176
|
+
`references/visionkit-scanner.md`.
|
|
226
177
|
|
|
227
|
-
##
|
|
178
|
+
## Segmentation
|
|
228
179
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
request.qualityLevel = .accurate // .balanced, .fast
|
|
180
|
+
`GeneratePersonSegmentationRequest` (iOS 18+, a stateful class) returns a
|
|
181
|
+
`PixelBufferObservation` mask. Read it as a `CGImage` with `try mask.cgImage`,
|
|
182
|
+
wrap it in `CIImage`, and composite with Core Image's
|
|
183
|
+
`CIFilter.blendWithMask()`.
|
|
234
184
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
let maskBuffer = mask.pixelBuffer
|
|
238
|
-
// Apply mask using Core Image: CIFilter.blendWithMask()
|
|
239
|
-
```
|
|
185
|
+
`qualityLevel` trades speed for detail. Approximate figures, to be confirmed
|
|
186
|
+
on the target device:
|
|
240
187
|
|
|
241
|
-
|
|
188
|
+
| Level | Detail | Rough cost | Mask size |
|
|
189
|
+
|---|---|---|---|
|
|
190
|
+
| `.accurate` | best edges | about 1 s | full resolution |
|
|
191
|
+
| `.balanced` | good | about 100 ms | 960 x 540 |
|
|
192
|
+
| `.fast` | coarse | about 10 ms | 256 x 144, suits real time |
|
|
242
193
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
request.outputPixelFormat = kCVPixelFormatType_OneComponent8
|
|
194
|
+
Legacy equivalent: `VNGeneratePersonSegmentationRequest` (iOS 15+) with
|
|
195
|
+
`qualityLevel`, `outputPixelFormat = kCVPixelFormatType_OneComponent8`, run
|
|
196
|
+
through `VNImageRequestHandler`; the mask is `request.results?.first?.pixelBuffer`.
|
|
247
197
|
|
|
248
|
-
|
|
249
|
-
try handler.perform([request])
|
|
198
|
+
Instance segmentation separates people from each other:
|
|
250
199
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
200
|
+
- `GeneratePersonInstanceMaskRequest` (iOS 18+) returns an optional
|
|
201
|
+
`InstanceMaskObservation`. `allInstances` is an `IndexSet`;
|
|
202
|
+
`generateMask(for: IndexSet(integer: n))` returns a `CVPixelBuffer` showing
|
|
203
|
+
only person `n`.
|
|
204
|
+
- `VNGeneratePersonInstanceMaskRequest` (iOS 17+) returns
|
|
205
|
+
`VNInstanceMaskObservation` with `allInstances`, `generateMask(forInstances:)`
|
|
206
|
+
and `generateMaskedImage(ofInstances:from:croppedToInstancesExtent:)`, which
|
|
207
|
+
takes the request handler and a crop flag.
|
|
254
208
|
|
|
255
|
-
|
|
256
|
-
- `.accurate` -- best quality, slowest (~1s), full resolution
|
|
257
|
-
- `.balanced` -- good quality, moderate speed (~100ms), 960x540
|
|
258
|
-
- `.fast` -- lowest quality, fastest (~10ms), 256x144, suitable for real-time
|
|
209
|
+
Code for masks, background blur and instances is in `references/vision-requests.md`.
|
|
259
210
|
|
|
260
|
-
|
|
211
|
+
## Object tracking
|
|
261
212
|
|
|
262
|
-
|
|
213
|
+
`TrackObjectRequest` (iOS 18+) is a `final class` that conforms to
|
|
214
|
+
`ImageProcessingRequest` and `StatefulRequest` and keeps the tracking context
|
|
215
|
+
between frames itself. Seed it once, then call `perform(on:)` on each frame
|
|
216
|
+
with the same instance:
|
|
263
217
|
|
|
264
218
|
```swift
|
|
265
|
-
|
|
266
|
-
let request = GeneratePersonInstanceMaskRequest()
|
|
267
|
-
let observation = try await request.perform(on: cgImage)
|
|
268
|
-
let indices = observation.allInstances
|
|
269
|
-
|
|
270
|
-
for index in indices {
|
|
271
|
-
let mask = try observation.generateMask(forInstances: IndexSet(integer: index))
|
|
272
|
-
// mask is a CVPixelBuffer with only this person visible
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
```swift
|
|
277
|
-
// Legacy API (iOS 17+)
|
|
278
|
-
let request = VNGeneratePersonInstanceMaskRequest()
|
|
279
|
-
let handler = VNImageRequestHandler(cgImage: cgImage)
|
|
280
|
-
try handler.perform([request])
|
|
281
|
-
|
|
282
|
-
guard let result = request.results?.first else { return }
|
|
283
|
-
let indices = result.allInstances
|
|
284
|
-
for index in indices {
|
|
285
|
-
let instanceMask = try result.generateMaskedImage(
|
|
286
|
-
ofInstances: IndexSet(integer: index),
|
|
287
|
-
from: handler,
|
|
288
|
-
croppedToInstancesExtent: false
|
|
289
|
-
)
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
See [references/vision-requests.md](references/vision-requests.md) for mask composition and Core Image filter
|
|
294
|
-
integration patterns.
|
|
295
|
-
|
|
296
|
-
## Object Tracking
|
|
219
|
+
import Vision
|
|
297
220
|
|
|
298
|
-
|
|
221
|
+
final class BallTracker {
|
|
222
|
+
private let request: TrackObjectRequest
|
|
299
223
|
|
|
300
|
-
|
|
301
|
-
|
|
224
|
+
init(startBox: NormalizedRect) {
|
|
225
|
+
request = TrackObjectRequest(detectedObject: DetectedObjectObservation(boundingBox: startBox))
|
|
226
|
+
}
|
|
302
227
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
request.trackingLevel = .accurate
|
|
308
|
-
|
|
309
|
-
// For each video frame:
|
|
310
|
-
let results = try await request.perform(on: pixelBuffer)
|
|
311
|
-
if let tracked = results.first {
|
|
312
|
-
let updatedBounds = tracked.boundingBox
|
|
313
|
-
let confidence = tracked.confidence
|
|
228
|
+
func follow(_ frame: CVPixelBuffer) async throws -> (NormalizedRect, Float)? {
|
|
229
|
+
guard let hit = try await request.perform(on: frame) else { return nil }
|
|
230
|
+
return (hit.boundingBox, hit.confidence)
|
|
231
|
+
}
|
|
314
232
|
}
|
|
315
233
|
```
|
|
316
234
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
let sequenceHandler = VNSequenceRequestHandler()
|
|
324
|
-
// For each frame:
|
|
325
|
-
try sequenceHandler.perform([trackRequest], on: pixelBuffer)
|
|
326
|
-
if let result = trackRequest.results?.first {
|
|
327
|
-
let updatedBounds = result.boundingBox
|
|
328
|
-
trackRequest.inputObservation = result
|
|
329
|
-
}
|
|
330
|
-
```
|
|
235
|
+
The Swift-native `TrackObjectRequest` has no `trackingLevel`;
|
|
236
|
+
`TrackRectangleRequest` does. With the legacy API, create
|
|
237
|
+
`VNTrackObjectRequest(detectedObjectObservation:)`, set
|
|
238
|
+
`trackingLevel = .accurate`, reuse one `VNSequenceRequestHandler` for every
|
|
239
|
+
frame via `perform([request], on: pixelBuffer)`, and feed each result back
|
|
240
|
+
through `inputObservation`.
|
|
331
241
|
|
|
332
|
-
## Other
|
|
242
|
+
## Other requests
|
|
333
243
|
|
|
334
|
-
|
|
244
|
+
All of these are Swift-native request types available on iOS 18 and macOS 15.
|
|
335
245
|
|
|
336
|
-
| Request |
|
|
246
|
+
| Request | What it gives you |
|
|
337
247
|
|---|---|
|
|
338
|
-
| `ClassifyImageRequest` |
|
|
339
|
-
| `GenerateAttentionBasedSaliencyImageRequest` | Heat map of where
|
|
340
|
-
| `GenerateObjectnessBasedSaliencyImageRequest` | Heat map of
|
|
341
|
-
| `GenerateForegroundInstanceMaskRequest` |
|
|
342
|
-
| `DetectRectanglesRequest` |
|
|
343
|
-
| `DetectHorizonRequest` |
|
|
344
|
-
| `DetectHumanBodyPoseRequest` |
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
347
|
-
| `
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
| `
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Run custom Core ML models through Vision for automatic image preprocessing
|
|
358
|
-
(resizing, normalization, color space conversion).
|
|
248
|
+
| `ClassifyImageRequest` | Scene labels (beach, food, dog, and so on) |
|
|
249
|
+
| `GenerateAttentionBasedSaliencyImageRequest` | Heat map of where a viewer's eye goes |
|
|
250
|
+
| `GenerateObjectnessBasedSaliencyImageRequest` | Heat map of regions that look like objects |
|
|
251
|
+
| `GenerateForegroundInstanceMaskRequest` | Masks for foreground subjects of any kind, not only people |
|
|
252
|
+
| `DetectRectanglesRequest` | Rectangular shapes: cards, receipts, screens |
|
|
253
|
+
| `DetectHorizonRequest` | Horizon angle for straightening a photo |
|
|
254
|
+
| `DetectHumanBodyPoseRequest` / `DetectHumanBodyPose3DRequest` | 2D body joints / 3D body pose |
|
|
255
|
+
| `DetectHumanHandPoseRequest` | Hand and finger joints |
|
|
256
|
+
| `DetectAnimalBodyPoseRequest` | Animal joints |
|
|
257
|
+
| `DetectFaceCaptureQualityRequest` | Face capture quality score 0...1, for choosing the best shot |
|
|
258
|
+
| `TrackRectangleRequest` | Follows a rectangle across frames |
|
|
259
|
+
| `TrackOpticalFlowRequest` | Motion field between consecutive frames |
|
|
260
|
+
| `DetectTrajectoriesRequest` | Paths of moving objects in video |
|
|
261
|
+
|
|
262
|
+
## Running Core ML models through Vision
|
|
263
|
+
|
|
264
|
+
Vision prepares the image for the model (scaling, cropping, pixel format,
|
|
265
|
+
color space, orientation), so hand it the original image.
|
|
359
266
|
|
|
360
267
|
```swift
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
let request = CoreMLRequest(model: .init(model))
|
|
364
|
-
let results = try await request.perform(on: cgImage)
|
|
365
|
-
|
|
366
|
-
// Classification model
|
|
367
|
-
if let classification = results.first as? ClassificationObservation {
|
|
368
|
-
let label = classification.identifier
|
|
369
|
-
let confidence = classification.confidence
|
|
370
|
-
}
|
|
371
|
-
```
|
|
268
|
+
import CoreML
|
|
269
|
+
import Vision
|
|
372
270
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
let
|
|
376
|
-
let
|
|
377
|
-
guard let
|
|
378
|
-
|
|
271
|
+
func plantSpecies(in leaf: CGImage, modelURL: URL) async throws -> (String, Float)? {
|
|
272
|
+
let model = try await MLModel.load(contentsOf: modelURL)
|
|
273
|
+
let request = CoreMLRequest(model: try CoreMLModelContainer(model: model))
|
|
274
|
+
let results = try await request.perform(on: leaf)
|
|
275
|
+
guard let best = results.first as? ClassificationObservation else { return nil }
|
|
276
|
+
return (best.identifier, best.confidence)
|
|
379
277
|
}
|
|
380
|
-
let handler = VNImageRequestHandler(cgImage: cgImage)
|
|
381
|
-
try handler.perform([request])
|
|
382
278
|
```
|
|
383
279
|
|
|
384
|
-
|
|
280
|
+
Before iOS 18: wrap the model with `VNCoreMLModel(for:)`, create
|
|
281
|
+
`VNCoreMLRequest(model:completionHandler:)`, cast `results` to
|
|
282
|
+
`[VNClassificationObservation]`, and run it with `VNImageRequestHandler`.
|
|
385
283
|
|
|
386
|
-
|
|
284
|
+
Model loading, compute units, conversion and optimization belong to the
|
|
285
|
+
`coreml` skill.
|
|
387
286
|
|
|
388
|
-
|
|
389
|
-
and barcodes. See [references/visionkit-scanner.md](references/visionkit-scanner.md) for complete patterns.
|
|
287
|
+
## VisionKit live scanning: DataScannerViewController
|
|
390
288
|
|
|
391
|
-
|
|
289
|
+
`DataScannerViewController` (iOS 16+) is a full-screen live camera that finds
|
|
290
|
+
text and barcodes and highlights them.
|
|
392
291
|
|
|
393
292
|
```swift
|
|
293
|
+
import UIKit
|
|
394
294
|
import VisionKit
|
|
395
295
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
scanner.delegate = self
|
|
411
|
-
present(scanner, animated: true) {
|
|
412
|
-
try? scanner.startScanning()
|
|
296
|
+
@MainActor
|
|
297
|
+
func presentTicketScanner(from host: UIViewController, delegate: DataScannerViewControllerDelegate) {
|
|
298
|
+
guard DataScannerViewController.isSupported, DataScannerViewController.isAvailable else { return }
|
|
299
|
+
let scanner = DataScannerViewController(
|
|
300
|
+
recognizedDataTypes: [.text(languages: ["en"]), .barcode(symbologies: [.qr, .aztec])],
|
|
301
|
+
qualityLevel: .balanced,
|
|
302
|
+
recognizesMultipleItems: false,
|
|
303
|
+
isHighFrameRateTrackingEnabled: true,
|
|
304
|
+
isHighlightingEnabled: true
|
|
305
|
+
)
|
|
306
|
+
scanner.delegate = delegate
|
|
307
|
+
host.present(scanner, animated: true) {
|
|
308
|
+
try? scanner.startScanning()
|
|
309
|
+
}
|
|
413
310
|
}
|
|
414
311
|
```
|
|
415
312
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
**
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
**
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
**
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
- [ ] Uses modern Vision API (iOS 18+) unless targeting older deployments
|
|
458
|
-
- [ ] Vision requests run off the main thread (async/await or background queue)
|
|
459
|
-
- [ ] Normalized coordinates converted before UI display
|
|
460
|
-
- [ ] Confidence threshold applied to filter low-quality observations
|
|
461
|
-
- [ ] Recognition level matches use case (`.fast` for video, `.accurate` for stills)
|
|
462
|
-
- [ ] Language hints set for text recognition when input language is known
|
|
463
|
-
- [ ] Barcode symbologies limited to only those needed
|
|
464
|
-
- [ ] `DataScannerViewController` availability checked before presentation
|
|
465
|
-
- [ ] Camera usage description (`NSCameraUsageDescription`) in Info.plist for VisionKit
|
|
466
|
-
- [ ] Person segmentation quality level appropriate for use case
|
|
467
|
-
- [ ] `VNSequenceRequestHandler` used for video frame tracking (not per-frame handler)
|
|
468
|
-
- [ ] Error handling covers request failures and empty results
|
|
313
|
+
`isSupported` checks the hardware (A12 Bionic or later); `isAvailable`
|
|
314
|
+
additionally requires camera permission. In SwiftUI, wrap the controller in a
|
|
315
|
+
`UIViewControllerRepresentable`; see `references/visionkit-scanner.md`.
|
|
316
|
+
|
|
317
|
+
## Common mistakes
|
|
318
|
+
|
|
319
|
+
1. **Legacy handlers in new code.** A project targeting iOS 18 or later should
|
|
320
|
+
use the struct requests and `perform(on:)`: typed results, async/await, and
|
|
321
|
+
Swift errors instead of casts and callbacks.
|
|
322
|
+
2. **Drawing normalized coordinates directly.** Vision uses 0...1 with a
|
|
323
|
+
lower-left origin; UIKit uses points from the top left. Convert with
|
|
324
|
+
`toImageCoordinates(_:origin:)`, `VNImageRectForNormalizedRect(_:_:_:)` or a
|
|
325
|
+
manual flip.
|
|
326
|
+
3. **Running requests on the main thread.** Recognition is heavy CPU/GPU work.
|
|
327
|
+
Await the async API from a task, or dispatch legacy handlers to a
|
|
328
|
+
background queue, never block the main actor.
|
|
329
|
+
4. **`.accurate` on a live camera feed.** It cannot keep up with 30 fps. Use
|
|
330
|
+
`.fast` for video and `.accurate` for photos and offline batches.
|
|
331
|
+
5. **Ignoring confidence.** Low-confidence results are often wrong; drop
|
|
332
|
+
anything under a threshold that fits the feature (0.5 is a common start).
|
|
333
|
+
6. **A new image handler per video frame when tracking.** Legacy tracking
|
|
334
|
+
needs `VNSequenceRequestHandler`, which carries temporal state across frames.
|
|
335
|
+
7. **Asking for every symbology.** Each extra symbology costs time and invites
|
|
336
|
+
false positives; list only the ones you accept, for example just `.qr`.
|
|
337
|
+
8. **Assuming the scanner exists.** Check `DataScannerViewController.isSupported`
|
|
338
|
+
(hardware) and `isAvailable` (hardware plus camera authorization) first.
|
|
339
|
+
|
|
340
|
+
## Review checklist
|
|
341
|
+
|
|
342
|
+
- [ ] Swift-native API used unless the deployment target is below iOS 18
|
|
343
|
+
- [ ] No Vision work blocks the main thread
|
|
344
|
+
- [ ] Normalized coordinates converted before anything is drawn
|
|
345
|
+
- [ ] Results filtered by a confidence threshold
|
|
346
|
+
- [ ] Recognition level fits the input: `.fast` for video, `.accurate` for stills
|
|
347
|
+
- [ ] Recognition languages set when the input language is known
|
|
348
|
+
- [ ] Barcode symbologies restricted to the needed set
|
|
349
|
+
- [ ] `DataScannerViewController` support and availability checked before presenting
|
|
350
|
+
- [ ] `NSCameraUsageDescription` present in Info.plist for VisionKit cameras
|
|
351
|
+
- [ ] Person segmentation quality level matches the use case
|
|
352
|
+
- [ ] Legacy video tracking uses one `VNSequenceRequestHandler`, not a handler per frame
|
|
353
|
+
- [ ] Request failures and empty results handled
|
|
469
354
|
|
|
470
355
|
## References
|
|
471
356
|
|
|
472
|
-
-
|
|
473
|
-
-
|
|
474
|
-
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
357
|
+
- `references/vision-requests.md`
|
|
358
|
+
- `references/visionkit-scanner.md`
|
|
359
|
+
- https://developer.apple.com/documentation/vision
|
|
360
|
+
- https://developer.apple.com/documentation/visionkit
|
|
361
|
+
- https://developer.apple.com/documentation/vision/recognizetextrequest
|
|
362
|
+
- https://developer.apple.com/documentation/visionkit/datascannerviewcontroller
|