@mmerterden/multi-agent-pipeline 20.37.0 → 20.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -49
- package/README.md +12 -10
- package/README.tr.md +12 -10
- package/docs/adr/0006-skills-core-external-split.md +5 -5
- package/docs/adr/0010-own-code-graph.md +6 -7
- package/docs/adr/0013-lsp-code-intelligence.md +6 -8
- package/docs/adr/0017-change-impact-from-the-graph.md +4 -5
- package/docs/adr/0018-cross-repo-links-not-a-global-graph.md +1 -1
- package/docs/adr/README.md +1 -1
- package/docs/ecosystem.md +53 -41
- package/docs/facts.json +15 -13
- package/docs/features.md +2 -2
- package/docs/recovery-guide.md +1 -1
- package/install/_dev-only-files.mjs +3 -0
- package/install/_platform-filter.mjs +1 -23
- package/install/catalog-history.json +1 -1
- package/install/claude.mjs +8 -1
- package/install/codex.mjs +0 -2
- package/install/copilot.mjs +0 -2
- package/install/templates/claude-hooks.json +47 -1
- package/manifest.json +455 -332
- package/package.json +5 -2
- package/pipeline/agents/security-auditor.md +58 -6
- package/pipeline/commands/multi-agent/build-optimize/SKILL.md +1 -2
- package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/design-check/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/graph/SKILL.md +12 -3
- package/pipeline/commands/multi-agent/manual-test/SKILL.md +12 -7
- package/pipeline/commands/multi-agent/research/SKILL.md +2 -2
- package/pipeline/commands/multi-agent/search/SKILL.md +10 -1
- package/pipeline/commands/multi-agent/security-review/SKILL.md +4 -0
- package/pipeline/commands/multi-agent/setup/SKILL.md +1 -0
- package/pipeline/commands/multi-agent/stack/SKILL.md +8 -0
- package/pipeline/commands/multi-agent/store-ready/SKILL.md +1 -1
- package/pipeline/commands/sim-test.md +34 -1
- package/pipeline/lib/context-budget.mjs +103 -0
- package/pipeline/lib/credential-inventory.sh +2 -3
- package/pipeline/lib/identifier-scan.mjs +145 -0
- package/pipeline/lib/outbound-gate.mjs +28 -1
- package/pipeline/lib/unattended-profile-check.mjs +13 -4
- package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
- package/pipeline/multi-agent-refs/analysis/redesign.md +17 -3
- package/pipeline/multi-agent-refs/analysis-template-corporate.md +8 -4
- package/pipeline/multi-agent-refs/analysis-template.md +7 -5
- package/pipeline/multi-agent-refs/audit-guide.md +20 -0
- package/pipeline/multi-agent-refs/complaint-analysis/phases.md +1 -0
- package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +1 -1
- package/pipeline/multi-agent-refs/features/code-graph.md +25 -0
- package/pipeline/multi-agent-refs/features/commit-multi-repo.md +63 -0
- package/pipeline/multi-agent-refs/features/design-conformance.md +20 -4
- package/pipeline/multi-agent-refs/features/dev-multi-repo.md +51 -0
- package/pipeline/multi-agent-refs/features/free-models.md +10 -3
- package/pipeline/multi-agent-refs/features/research.md +4 -3
- package/pipeline/multi-agent-refs/features/security-audit.md +25 -3
- package/pipeline/multi-agent-refs/features/test-gap.md +40 -0
- package/pipeline/multi-agent-refs/features/unattended-security.md +20 -0
- package/pipeline/multi-agent-refs/features/worktree-finalize.md +1 -1
- package/pipeline/multi-agent-refs/help/en.md +15 -9
- package/pipeline/multi-agent-refs/help/tr.md +15 -9
- package/pipeline/multi-agent-refs/knowledge.md +17 -0
- package/pipeline/multi-agent-refs/orchestrator/phase-3-user-test.md +12 -9
- package/pipeline/multi-agent-refs/outside-the-pipeline.md +9 -0
- package/pipeline/multi-agent-refs/phases/log-format.md +5 -0
- package/pipeline/multi-agent-refs/phases/operations.md +3 -5
- package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
- package/pipeline/multi-agent-refs/phases/phase-2-dev.md +8 -47
- package/pipeline/multi-agent-refs/phases/phase-3-review.md +21 -65
- package/pipeline/multi-agent-refs/phases/phase-4-commit.md +9 -59
- package/pipeline/multi-agent-refs/phases/phase-5-report.md +0 -31
- package/pipeline/multi-agent-refs/picker-contract.md +1 -1
- package/pipeline/multi-agent-refs/research/engine.md +2 -1
- package/pipeline/multi-agent-refs/rules.md +1 -1
- package/pipeline/multi-agent-refs/setup/free-models.md +10 -0
- package/pipeline/multi-agent-refs/store-ready/gate-3-policy.md +15 -0
- package/pipeline/multi-agent-refs/web-guide.md +2 -1
- package/pipeline/office/index.html +8 -9
- package/pipeline/office/toolkit.json +1 -1
- package/pipeline/rules/figma-pipeline.md +6 -3
- package/pipeline/rules/outside-the-pipeline.md +1 -1
- package/pipeline/schemas/learnings-ledger.schema.json +7 -2
- package/pipeline/schemas/prefs.schema.json +17 -4
- package/pipeline/schemas/reviewer-output.schema.json +113 -5
- package/pipeline/schemas/secret-patterns.json +49 -0
- package/pipeline/schemas/security-finding.schema.json +49 -5
- package/pipeline/scripts/_code-graph.mjs +3 -3
- package/pipeline/scripts/_graph-analysis.mjs +51 -0
- package/pipeline/scripts/_memory-policy.mjs +37 -7
- package/pipeline/scripts/_secret-scan.mjs +1 -1
- package/pipeline/scripts/_skill-practices.mjs +178 -0
- package/pipeline/scripts/_stack-routing.mjs +1 -0
- package/pipeline/scripts/autopilot-runner.mjs +8 -3
- package/pipeline/scripts/build-stack-plugins.mjs +8 -44
- package/pipeline/scripts/capture-resume.sh +19 -0
- package/pipeline/scripts/checkpoint-fold.sh +59 -0
- package/pipeline/scripts/file-context.mjs +306 -70
- package/pipeline/scripts/gate-ledger.mjs +1 -1
- package/pipeline/scripts/gen-skills-index.mjs +1 -1
- package/pipeline/scripts/graph-hint.mjs +197 -0
- package/pipeline/scripts/graph-hint.sh +20 -0
- package/pipeline/scripts/graph-query.mjs +306 -11
- package/pipeline/scripts/graph-report.mjs +29 -1
- package/pipeline/scripts/learnings-ledger.mjs +71 -15
- package/pipeline/scripts/note-agent-event.mjs +160 -0
- package/pipeline/scripts/note-agent-event.sh +19 -0
- package/pipeline/scripts/office-control.mjs +41 -15
- package/pipeline/scripts/offload-ref.sh +1 -1
- package/pipeline/scripts/parity-score.mjs +139 -0
- package/pipeline/scripts/pre-commit-check.sh +25 -4
- package/pipeline/scripts/pre-push-check.sh +3 -0
- package/pipeline/scripts/repo-recommend.mjs +321 -0
- package/pipeline/scripts/rework-rulings.mjs +5 -3
- package/pipeline/scripts/scan-agent-config.sh +1 -2
- package/pipeline/scripts/scope-check-gate.mjs +15 -2
- package/pipeline/scripts/security-evidence-gate.mjs +282 -0
- package/pipeline/scripts/unattended_policy.py +3 -2
- package/pipeline/scripts/user-test-handoff.sh +203 -0
- package/pipeline/scripts/validate-analysis-doc.mjs +17 -1
- package/pipeline/scripts/validate-planning.mjs +5 -3
- package/pipeline/scripts/validate-triage.mjs +2 -1
- package/pipeline/scripts/write-state.mjs +13 -4
- package/pipeline/skills/.skill-manifest.json +73 -69
- package/pipeline/skills/shared/README.md +41 -40
- package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +6 -6
- package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +1 -1
- package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +1 -1
- package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +1 -1
- package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +1 -1
- package/pipeline/skills/shared/core/multi-agent/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-build-optimize/SKILL.md +0 -1
- package/pipeline/skills/shared/core/multi-agent-complaint-analysis/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +5 -5
- package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +10 -0
- package/pipeline/skills/shared/core/multi-agent-manual-test/SKILL.md +12 -7
- package/pipeline/skills/shared/core/multi-agent-research/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent-search/SKILL.md +9 -0
- package/pipeline/skills/shared/core/multi-agent-security-review/SKILL.md +3 -2
- package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +1 -0
- package/pipeline/skills/shared/core/multi-agent-stack/SKILL.md +8 -0
- package/pipeline/skills/shared/core/multi-agent-store-ready/SKILL.md +4 -3
- package/pipeline/skills/shared/core/multi-agent-test/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-accessibility/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-dark-mode/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-dynamic-type/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-gen/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-test-screenshots/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-testflight-validation/SKILL.md +2 -2
- package/pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/agent-introspection-debugging/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/android-architecture/SKILL.md +1 -1
- package/pipeline/skills/shared/external/android-architecture/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-build-quality-gates/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-datastore/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-design-tokens-codegen/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/android-jetpack-compose-expert/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/android-mvi-viewmodel/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/android-performance/SKILL.md +1 -1
- package/pipeline/skills/shared/external/android-performance/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/android-security/SKILL.md +1 -1
- package/pipeline/skills/shared/external/android-security/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/api-patterns/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/api-security-best-practices/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/app-store-changelog/SKILL.md +65 -49
- package/pipeline/skills/shared/external/app-store-changelog/evals/evals.json +40 -0
- package/pipeline/skills/shared/external/app-store-changelog/references/release-notes-guidelines.md +64 -34
- package/pipeline/skills/shared/external/app-store-changelog/scripts/collect_release_changes.sh +21 -23
- package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +4 -1
- package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -0
- package/pipeline/skills/shared/external/architecture/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/backlog/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/ci-cd-pipelines/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/clean-code/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/compose-components/SKILL.md +1 -1
- package/pipeline/skills/shared/external/compose-components/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/compose-navigation/SKILL.md +1 -1
- package/pipeline/skills/shared/external/compose-navigation/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/compose-testing/SKILL.md +1 -1
- package/pipeline/skills/shared/external/compose-testing/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/context-compression/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/core-data/SKILL.md +1 -1
- package/pipeline/skills/shared/external/council/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/css-modern/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/css-modern/references/code-examples.md +5 -0
- package/pipeline/skills/shared/external/database-patterns/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +5 -0
- package/pipeline/skills/shared/external/debugging-strategies/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/docker-expert/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/e2e-testing/SKILL.md +21 -21
- package/pipeline/skills/shared/external/e2e-testing/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/e2e-testing/references/document-fixtures.md +5 -5
- package/pipeline/skills/shared/external/evidence-github/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/evidence-registry/SKILL.md +1 -1
- package/pipeline/skills/shared/external/evidence-registry/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/fastapi-pro/evals/evals.json +57 -0
- package/pipeline/skills/shared/external/firebase/SKILL.md +132 -54
- package/pipeline/skills/shared/external/firebase/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/firebase/references/functions-and-products.md +51 -0
- package/pipeline/skills/shared/external/firebase/references/security-rules.md +59 -0
- package/pipeline/skills/shared/external/fix-review-verdicts/evals/evals.json +57 -0
- package/pipeline/skills/shared/external/free-llm-apis/SKILL.md +70 -0
- package/pipeline/skills/shared/external/free-llm-apis/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +33 -0
- package/pipeline/skills/shared/external/github-actions-templates/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +1 -1
- package/pipeline/skills/shared/external/gradle-kotlin-dsl/evals/evals.json +58 -0
- package/pipeline/skills/shared/external/handle-request/SKILL.md +2 -2
- package/pipeline/skills/shared/external/handle-request/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/hig-app-icons/SKILL.md +2 -2
- package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +1 -1
- package/pipeline/skills/shared/external/hig-components-content/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/hig-components-status/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/hig-components-system/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/hig-inputs/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/hig-patterns/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/hig-platforms/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/hig-technologies/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/html-semantic/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/humanizer/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/ios-coding-standard/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/ios-debugger-agent/SKILL.md +91 -52
- package/pipeline/skills/shared/external/ios-debugger-agent/evals/evals.json +41 -0
- package/pipeline/skills/shared/external/ios-design-review/SKILL.md +12 -12
- package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +16 -16
- package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +1 -1
- package/pipeline/skills/shared/external/ios-iphone-duo/SKILL.md +0 -1
- package/pipeline/skills/shared/external/ios-module-structure/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/ios-security/SKILL.md +1 -1
- package/pipeline/skills/shared/external/ios-security/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/kotlin-coroutines-expert/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/localization-reuse-map/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/macos-menubar-tuist-app/SKILL.md +170 -74
- package/pipeline/skills/shared/external/macos-menubar-tuist-app/evals/evals.json +52 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/SKILL.md +119 -77
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Package.swift +5 -5
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/MyApp.swift +24 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/version.env +2 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/build_icon.sh +46 -39
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/compile_and_run.sh +70 -49
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/launch.sh +24 -17
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/make_appcast.sh +74 -59
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/package_app.sh +201 -170
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +50 -42
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +65 -35
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/version.env +2 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/macos-spm-app-packaging/references/packaging.md +49 -17
- package/pipeline/skills/shared/external/macos-spm-app-packaging/references/release.md +48 -23
- package/pipeline/skills/shared/external/macos-spm-app-packaging/references/scaffold.md +74 -44
- package/pipeline/skills/shared/external/monorepo-architect/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +14 -3
- package/pipeline/skills/shared/external/nextjs-app-router/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +3 -0
- package/pipeline/skills/shared/external/nodejs-backend-patterns/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/observability-engineer/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +10 -0
- package/pipeline/skills/shared/external/photos-camera-media/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/play-store-review/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/python-patterns/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/react-best-practices/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/rest-api-design/evals/evals.json +46 -0
- package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +1 -1
- package/pipeline/skills/shared/external/retrofit-networking/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/room-database/SKILL.md +1 -1
- package/pipeline/skills/shared/external/room-database/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/scenario-gap-analysis/SKILL.md +1 -1
- package/pipeline/skills/shared/external/scenario-gap-analysis/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/search-first/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/security-review/SKILL.md +14 -3
- package/pipeline/skills/shared/external/security-review/evals/evals.json +48 -0
- package/pipeline/skills/shared/external/security-review/references/agentic-systems.md +93 -0
- package/pipeline/skills/shared/external/security-review/references/firebase-rules.md +100 -0
- package/pipeline/skills/shared/external/security-review/references/graphql.md +82 -0
- package/pipeline/skills/shared/external/security-review/references/llm-prompt-injection.md +93 -0
- package/pipeline/skills/shared/external/security-review/references/oauth-oidc.md +100 -0
- package/pipeline/skills/shared/external/security-review/references/owasp-mobile-top10-2024.md +1 -1
- package/pipeline/skills/shared/external/security-review/references/owasp-web-api-top10-2021.md +1 -1
- package/pipeline/skills/shared/external/security-review/references/supabase.md +73 -0
- package/pipeline/skills/shared/external/signal-community/SKILL.md +29 -10
- package/pipeline/skills/shared/external/signal-community/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/skill-creator/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/skill-creator/template.md +1 -3
- package/pipeline/skills/shared/external/spm-build-analysis/SKILL.md +80 -61
- package/pipeline/skills/shared/external/spm-build-analysis/evals/evals.json +56 -0
- package/pipeline/skills/shared/external/spm-build-analysis/references/build-optimization-sources.md +83 -133
- package/pipeline/skills/shared/external/spm-build-analysis/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/spm-build-analysis/references/spm-analysis-checks.md +89 -87
- package/pipeline/skills/shared/external/spm-build-analysis/scripts/check_spm_pins.py +90 -85
- package/pipeline/skills/shared/external/swift-concurrency-expert/SKILL.md +78 -69
- package/pipeline/skills/shared/external/swift-concurrency-expert/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/approachable-concurrency.md +52 -48
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/swift-6-2-concurrency.md +118 -184
- package/pipeline/skills/shared/external/swift-concurrency-expert/references/swiftui-concurrency-tour-wwdc.md +68 -22
- package/pipeline/skills/shared/external/swift-concurrency-pro/SKILL.md +117 -94
- package/pipeline/skills/shared/external/swift-concurrency-pro/evals/evals.json +57 -0
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/actors.md +102 -97
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/async-streams.md +36 -37
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/bridging.md +82 -34
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/bug-patterns.md +90 -52
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/cancellation.md +55 -55
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/diagnostics.md +66 -43
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/hotspots.md +39 -23
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/interop.md +66 -68
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/new-features.md +152 -131
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/structured.md +60 -57
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/testing.md +131 -118
- package/pipeline/skills/shared/external/swift-concurrency-pro/references/unstructured.md +37 -29
- package/pipeline/skills/shared/external/swift-formatstyle/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +77 -58
- package/pipeline/skills/shared/external/swift-testing-pro/evals/evals.json +59 -0
- package/pipeline/skills/shared/external/swift-testing-pro/references/async-tests.md +139 -144
- package/pipeline/skills/shared/external/swift-testing-pro/references/core-rules.md +90 -28
- package/pipeline/skills/shared/external/swift-testing-pro/references/migrating-from-xctest.md +38 -21
- package/pipeline/skills/shared/external/swift-testing-pro/references/new-features.md +139 -156
- package/pipeline/skills/shared/external/swift-testing-pro/references/writing-better-tests.md +173 -147
- package/pipeline/skills/shared/external/swiftdata-pro/SKILL.md +75 -59
- package/pipeline/skills/shared/external/swiftdata-pro/evals/evals.json +50 -0
- package/pipeline/skills/shared/external/swiftdata-pro/references/cloudkit.md +34 -7
- package/pipeline/skills/shared/external/swiftdata-pro/references/indexing.md +20 -14
- package/pipeline/skills/shared/external/swiftdata-pro/references/inheritance.md +127 -0
- package/pipeline/skills/shared/external/swiftdata-pro/references/model-rules.md +141 -0
- package/pipeline/skills/shared/external/swiftdata-pro/references/predicates.md +37 -44
- package/pipeline/skills/shared/external/swiftlint/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/SKILL.md +89 -88
- package/pipeline/skills/shared/external/swiftui-expert-skill/evals/evals.json +55 -0
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/accessibility-patterns.md +104 -122
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-advanced.md +73 -93
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-basics.md +144 -169
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-transitions.md +122 -133
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts-accessibility.md +141 -99
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts.md +273 -333
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/image-optimization.md +105 -128
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/latest-apis.md +199 -312
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/layout-best-practices.md +129 -169
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/liquid-glass.md +17 -30
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/list-patterns.md +198 -258
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-scenes.md +145 -218
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-views.md +150 -249
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-window-styling.md +109 -208
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/performance-patterns.md +225 -271
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/scroll-patterns.md +117 -210
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/sheet-navigation-patterns.md +171 -237
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/state-management.md +196 -260
- package/pipeline/skills/shared/external/swiftui-expert-skill/references/view-structure.md +167 -230
- package/pipeline/skills/shared/external/swiftui-gestures/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swiftui-layout-components/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swiftui-navigation/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +1 -2
- package/pipeline/skills/shared/external/swiftui-patterns/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/swiftui-performance/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/SKILL.md +71 -79
- package/pipeline/skills/shared/external/swiftui-performance-audit/evals/evals.json +55 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/audit-layout.md +50 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/capture-checklist.md +51 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/hangs.md +34 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/instruments-guide.md +68 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/smell-catalog.md +191 -0
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/update-model.md +69 -0
- package/pipeline/skills/shared/external/swiftui-pro/SKILL.md +65 -63
- package/pipeline/skills/shared/external/swiftui-pro/evals/evals.json +45 -0
- package/pipeline/skills/shared/external/swiftui-pro/references/accessibility.md +40 -13
- package/pipeline/skills/shared/external/swiftui-pro/references/api.md +74 -29
- package/pipeline/skills/shared/external/swiftui-pro/references/data.md +44 -24
- package/pipeline/skills/shared/external/swiftui-pro/references/design.md +45 -31
- package/pipeline/skills/shared/external/swiftui-pro/references/hygiene.md +17 -8
- package/pipeline/skills/shared/external/swiftui-pro/references/navigation.md +19 -9
- package/pipeline/skills/shared/external/swiftui-pro/references/performance.md +50 -34
- package/pipeline/skills/shared/external/swiftui-pro/references/swift.md +73 -45
- package/pipeline/skills/shared/external/swiftui-pro/references/views.md +48 -23
- package/pipeline/skills/shared/external/swiftui-ui-patterns/SKILL.md +89 -83
- package/pipeline/skills/shared/external/swiftui-ui-patterns/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/app-wiring.md +119 -114
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/async-state.md +76 -61
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/components-index.md +63 -46
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/controls.md +32 -31
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/deeplinks.md +49 -38
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/focus.md +77 -49
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/form.md +61 -44
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/grids.md +40 -42
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/input-toolbar.md +44 -31
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/lightweight-clients.md +90 -64
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/list.md +48 -49
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/loading-placeholders.md +36 -25
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/macos-settings.md +30 -30
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/matched-transitions.md +49 -32
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/media.md +49 -41
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/menu-bar.md +52 -48
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/navigationstack.md +119 -104
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/overlay.md +30 -27
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/performance.md +33 -31
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/previews.md +27 -27
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scroll-reveal.md +79 -86
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scrollview.md +47 -40
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/searchable.md +55 -40
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/sheets.md +113 -84
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/split-views.md +37 -34
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/tabview.md +75 -75
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/theming.md +37 -32
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/title-menus.md +41 -51
- package/pipeline/skills/shared/external/swiftui-ui-patterns/references/top-bar.md +46 -30
- package/pipeline/skills/shared/external/swiftui-uikit-interop/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/swiftui-view-refactor/SKILL.md +152 -121
- package/pipeline/skills/shared/external/swiftui-view-refactor/evals/evals.json +56 -0
- package/pipeline/skills/shared/external/swiftui-view-refactor/references/mv-patterns.md +107 -98
- package/pipeline/skills/shared/external/swiftui-webkit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/tailwind-css/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/test-result-triage/SKILL.md +2 -2
- package/pipeline/skills/shared/external/test-result-triage/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/testing-backend/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/tipkit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/typescript-patterns/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/valven-rules/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/vision-framework/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/vue-composition/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/weatherkit/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/web-accessibility/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/web-performance/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/web-testing/SKILL.md +2 -2
- package/pipeline/skills/shared/external/web-testing/evals/evals.json +43 -0
- package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +2 -2
- package/pipeline/skills/shared/external/widgetkit/evals/evals.json +44 -0
- package/pipeline/skills/shared/external/xcode-build-benchmark/SKILL.md +61 -55
- package/pipeline/skills/shared/external/xcode-build-benchmark/evals/evals.json +42 -0
- package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmark-artifacts.md +69 -67
- package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmarking-workflow.md +39 -47
- package/pipeline/skills/shared/external/xcode-build-benchmark/schemas/build-benchmark.schema.json +72 -154
- package/pipeline/skills/shared/external/xcode-build-benchmark/scripts/benchmark_builds.py +207 -245
- package/pipeline/skills/shared/external/xcode-build-fixer/SKILL.md +145 -139
- package/pipeline/skills/shared/external/xcode-build-fixer/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-build-fixer/references/build-settings-best-practices.md +81 -175
- package/pipeline/skills/shared/external/xcode-build-fixer/references/fix-patterns.md +188 -143
- package/pipeline/skills/shared/external/xcode-build-fixer/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/xcode-build-fixer/scripts/benchmark_builds.py +207 -245
- package/pipeline/skills/shared/external/xcode-build-orchestrator/SKILL.md +107 -98
- package/pipeline/skills/shared/external/xcode-build-orchestrator/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/benchmark-artifacts.md +69 -67
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/build-settings-best-practices.md +81 -175
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/orchestration-report-template.md +81 -69
- package/pipeline/skills/shared/external/xcode-build-orchestrator/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/benchmark_builds.py +207 -245
- package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/diagnose_compilation.py +155 -210
- package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/generate_optimization_report.py +355 -480
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/SKILL.md +70 -69
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/build-optimization-sources.md +83 -133
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/code-compilation-checks.md +85 -73
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/recommendation-format.md +41 -40
- package/pipeline/skills/shared/external/xcode-compilation-analyzer/scripts/diagnose_compilation.py +155 -210
- package/pipeline/skills/shared/external/xcode-project-analyzer/SKILL.md +54 -52
- package/pipeline/skills/shared/external/xcode-project-analyzer/evals/evals.json +54 -0
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-optimization-sources.md +83 -133
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-settings-best-practices.md +81 -175
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/project-audit-checks.md +115 -83
- package/pipeline/skills/shared/external/xcode-project-analyzer/references/recommendation-format.md +41 -40
- package/pipeline/scripts/_notices.mjs +0 -171
- package/pipeline/skills/shared/external/NOTICE-avdlee-swiftui-agent-skill.md +0 -48
- package/pipeline/skills/shared/external/NOTICE-dimillian-skills.md +0 -63
- package/pipeline/skills/shared/external/NOTICE-paul-hudson-skills.md +0 -54
- package/pipeline/skills/shared/external/NOTICE-vibeship-spawner-skills.md +0 -203
- package/pipeline/skills/shared/external/NOTICE-xcode-build-skills.md +0 -60
- package/pipeline/skills/shared/external/ios-iphone-duo/NOTICE.md +0 -53
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/main.swift +0 -11
- package/pipeline/skills/shared/external/swiftdata-pro/references/class-inheritance.md +0 -104
- package/pipeline/skills/shared/external/swiftdata-pro/references/core-rules.md +0 -20
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/code-smells.md +0 -158
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +0 -46
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +0 -29
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/profiling-intake.md +0 -44
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/report-template.md +0 -47
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +0 -33
- package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +0 -52
|
@@ -1,161 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Swift Charts
|
|
2
2
|
|
|
3
3
|
<!-- toc -->
|
|
4
|
-
- [
|
|
5
|
-
- [
|
|
6
|
-
- [
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
10
|
-
- [Selection APIs](#selection-apis)
|
|
4
|
+
- [Version Matrix](#version-matrix)
|
|
5
|
+
- [Setup](#setup)
|
|
6
|
+
- [Marks](#marks)
|
|
7
|
+
- [Chart3D (iOS 26+)](#chart3d-ios-26)
|
|
8
|
+
- [Axes](#axes)
|
|
9
|
+
- [Selection (iOS 17+)](#selection-ios-17)
|
|
11
10
|
- [Annotations](#annotations)
|
|
12
|
-
- [
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [Animating
|
|
17
|
-
- [
|
|
11
|
+
- [Custom Gestures with ChartProxy](#custom-gestures-with-chartproxy)
|
|
12
|
+
- [Where Modifiers Go](#where-modifiers-go)
|
|
13
|
+
- [Visual Channels](#visual-channels)
|
|
14
|
+
- [Layering Marks](#layering-marks)
|
|
15
|
+
- [Animating Data Changes](#animating-data-changes)
|
|
16
|
+
- [Guidelines](#guidelines)
|
|
18
17
|
<!-- /toc -->
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Building 2D charts with Swift Charts: marks, plot types, axes, scales, built-in selection, annotations, `ChartProxy` gestures, styling channels and data animation, plus a section on `Chart3D`. Accessibility, version fallbacks and a final checklist are in `charts-accessibility.md`.
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
- [Availability](#availability)
|
|
24
|
-
- [Core APIs](#core-apis)
|
|
25
|
-
- [Chart Types](#chart-types)
|
|
26
|
-
- [Axis Tweaks](#axis-tweaks)
|
|
27
|
-
- [Selection APIs](#selection-apis)
|
|
28
|
-
- [Annotations](#annotations)
|
|
29
|
-
- [ChartProxy and Custom Touch Handling](#chartproxy-and-custom-touch-handling)
|
|
30
|
-
- [Modifier Scope](#modifier-scope)
|
|
31
|
-
- [Styling and Visual Channels](#styling-and-visual-channels)
|
|
32
|
-
- [Composing Multiple Marks](#composing-multiple-marks)
|
|
33
|
-
- [Animating Chart Data](#animating-chart-data)
|
|
34
|
-
- [Best Practices](#best-practices)
|
|
35
|
-
|
|
36
|
-
## Overview
|
|
21
|
+
Every chart starts from a `Chart` view that holds marks. Seven mark families exist: sector, rectangle, rule, point, area, line and bar.
|
|
37
22
|
|
|
38
|
-
|
|
23
|
+
## Version Matrix
|
|
39
24
|
|
|
40
|
-
|
|
25
|
+
| Minimum OS | What becomes available |
|
|
26
|
+
|------------|------------------------|
|
|
27
|
+
| iOS 16 | the `Chart` container with scales and custom axes; `RuleMark`, `PointMark`, `RectangleMark`, `LineMark`, `AreaMark`, `BarMark` |
|
|
28
|
+
| iOS 17 | `SectorMark`, built-in selection modifiers, scrollable chart axes |
|
|
29
|
+
| iOS 18 | plot types (`LinePlot`, `BarPlot` and the rest) that take whole collections |
|
|
30
|
+
| iOS 26 | `Chart3D` and the Z-axis APIs |
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- `BarMark`, `LineMark`, `AreaMark`, `PointMark`, `RectangleMark`, and `RuleMark` are available on iOS 16+
|
|
45
|
-
- `SectorMark`, built-in selection, and scrollable chart axes require iOS 17+
|
|
46
|
-
- Data-driven plot types such as `BarPlot` and `LinePlot` require iOS 18+
|
|
47
|
-
- Chart3D and Z-axis APIs exist on iOS 26+; this reference is primarily about 2D `Chart`, with a dedicated Chart3D section below
|
|
32
|
+
Gate anything above your deployment target:
|
|
48
33
|
|
|
49
34
|
```swift
|
|
50
35
|
if #available(iOS 17, *) {
|
|
51
|
-
//
|
|
36
|
+
// sector marks, selection, scrolling axes
|
|
52
37
|
} else {
|
|
53
|
-
//
|
|
38
|
+
// iOS 16 chart: core marks, axes, scales
|
|
54
39
|
}
|
|
55
40
|
```
|
|
56
41
|
|
|
57
|
-
##
|
|
42
|
+
## Setup
|
|
58
43
|
|
|
59
|
-
### Import
|
|
44
|
+
### Import Charts
|
|
60
45
|
|
|
61
|
-
|
|
46
|
+
A file that uses `Chart`, `Chart3D`, any mark, or `ChartProxy` needs its own import. When chart types fail to resolve, check this first.
|
|
62
47
|
|
|
63
48
|
```swift
|
|
64
49
|
import SwiftUI
|
|
65
50
|
import Charts
|
|
66
51
|
```
|
|
67
52
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Chart Container
|
|
71
|
-
|
|
72
|
-
`Chart` is the root view. Add one or more marks inside it.
|
|
73
|
-
|
|
74
|
-
```swift
|
|
75
|
-
Chart(sales) { item in
|
|
76
|
-
BarMark(
|
|
77
|
-
x: .value("Month", item.month),
|
|
78
|
-
y: .value("Revenue", item.revenue)
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Data Models Should Be Identifiable
|
|
53
|
+
### Give the data stable identity
|
|
84
54
|
|
|
85
|
-
|
|
55
|
+
`Chart(data)` wants `Identifiable` elements so that each point keeps its identity as the collection changes. If the type cannot conform, name the identifying key path with `id:`.
|
|
86
56
|
|
|
87
57
|
```swift
|
|
88
|
-
struct
|
|
58
|
+
struct FuelReading: Identifiable {
|
|
89
59
|
let id: UUID
|
|
90
|
-
let
|
|
91
|
-
let
|
|
60
|
+
let leg: String
|
|
61
|
+
let kilograms: Double
|
|
92
62
|
}
|
|
93
|
-
```
|
|
94
63
|
|
|
95
|
-
|
|
64
|
+
Chart(readings) { reading in
|
|
65
|
+
BarMark(
|
|
66
|
+
x: .value("Leg", reading.leg),
|
|
67
|
+
y: .value("Fuel burned (kg)", reading.kilograms)
|
|
68
|
+
)
|
|
69
|
+
}
|
|
96
70
|
|
|
97
|
-
|
|
98
|
-
Chart(
|
|
71
|
+
// Without Identifiable
|
|
72
|
+
Chart(readings, id: \.leg) { reading in
|
|
99
73
|
BarMark(
|
|
100
|
-
x: .value("
|
|
101
|
-
y: .value("
|
|
74
|
+
x: .value("Leg", reading.leg),
|
|
75
|
+
y: .value("Fuel burned (kg)", reading.kilograms)
|
|
102
76
|
)
|
|
103
77
|
}
|
|
104
78
|
```
|
|
105
79
|
|
|
106
|
-
### Plottable
|
|
80
|
+
### Plottable values
|
|
107
81
|
|
|
108
|
-
|
|
82
|
+
Each coordinate is written `.value(label, value)`. The label is not decoration: axes, legends and VoiceOver all reuse it, so make it say what the number means.
|
|
109
83
|
|
|
110
84
|
```swift
|
|
111
85
|
LineMark(
|
|
112
|
-
x: .value("
|
|
113
|
-
y: .value("
|
|
86
|
+
x: .value("Departure date", flight.date),
|
|
87
|
+
y: .value("Passengers", flight.passengerCount)
|
|
114
88
|
)
|
|
115
89
|
```
|
|
116
90
|
|
|
117
|
-
##
|
|
91
|
+
## Marks
|
|
118
92
|
|
|
119
93
|
### BarMark
|
|
120
94
|
|
|
121
95
|
```swift
|
|
122
96
|
BarMark(
|
|
123
|
-
x: .value("
|
|
124
|
-
y: .value("
|
|
97
|
+
x: .value("Aircraft", fleetEntry.model),
|
|
98
|
+
y: .value("Flights", fleetEntry.flightCount)
|
|
125
99
|
)
|
|
126
100
|
```
|
|
127
101
|
|
|
128
|
-
Stacking
|
|
102
|
+
Stacking is a `MarkStackingMethod`: `.standard`, `.normalized`, `.center` or `.unstacked`.
|
|
129
103
|
|
|
130
104
|
### LineMark
|
|
131
105
|
|
|
132
106
|
```swift
|
|
133
107
|
LineMark(
|
|
134
|
-
x: .value("
|
|
135
|
-
y: .value("
|
|
108
|
+
x: .value("Flight hour", sample.hour),
|
|
109
|
+
y: .value("Altitude (ft)", sample.altitude)
|
|
136
110
|
)
|
|
137
|
-
.interpolationMethod(.
|
|
111
|
+
.interpolationMethod(.catmullRom)
|
|
138
112
|
```
|
|
139
113
|
|
|
140
|
-
|
|
114
|
+
Curves to choose from: `.catmullRom` (optional alpha), `.cardinal` (optional tension), `.monotone`, `.linear`, and the step variants `.stepEnd`, `.stepCenter`, `.stepStart`.
|
|
141
115
|
|
|
142
116
|
### AreaMark
|
|
143
117
|
|
|
144
118
|
```swift
|
|
145
119
|
AreaMark(
|
|
146
|
-
x: .value("
|
|
147
|
-
y: .value("
|
|
120
|
+
x: .value("Minute", reading.minute),
|
|
121
|
+
y: .value("Cabin pressure", reading.pressure),
|
|
148
122
|
stacking: .unstacked
|
|
149
123
|
)
|
|
124
|
+
.opacity(0.6)
|
|
150
125
|
```
|
|
151
126
|
|
|
152
|
-
|
|
127
|
+
For a band such as a min/max range or a confidence interval, give the mark `yStart` and `yEnd`:
|
|
153
128
|
|
|
154
129
|
```swift
|
|
155
130
|
AreaMark(
|
|
156
|
-
x: .value("
|
|
157
|
-
yStart: .value("
|
|
158
|
-
yEnd: .value("
|
|
131
|
+
x: .value("Month", forecast.month),
|
|
132
|
+
yStart: .value("Lowest fare", forecast.lowestFare),
|
|
133
|
+
yEnd: .value("Highest fare", forecast.highestFare)
|
|
159
134
|
)
|
|
160
135
|
```
|
|
161
136
|
|
|
@@ -163,8 +138,8 @@ AreaMark(
|
|
|
163
138
|
|
|
164
139
|
```swift
|
|
165
140
|
PointMark(
|
|
166
|
-
x: .value("
|
|
167
|
-
y: .value("
|
|
141
|
+
x: .value("Distance (km)", route.distance),
|
|
142
|
+
y: .value("Duration (min)", route.duration)
|
|
168
143
|
)
|
|
169
144
|
```
|
|
170
145
|
|
|
@@ -172,68 +147,64 @@ PointMark(
|
|
|
172
147
|
|
|
173
148
|
```swift
|
|
174
149
|
RectangleMark(
|
|
175
|
-
xStart: .value("
|
|
176
|
-
xEnd: .value("
|
|
177
|
-
yStart: .value("
|
|
178
|
-
yEnd: .value("
|
|
150
|
+
xStart: .value("Window opens", slot.opensDay),
|
|
151
|
+
xEnd: .value("Window closes", slot.closesDay),
|
|
152
|
+
yStart: .value("Min load", slot.minLoad),
|
|
153
|
+
yEnd: .value("Max load", slot.maxLoad)
|
|
179
154
|
)
|
|
180
155
|
```
|
|
181
156
|
|
|
182
157
|
### RuleMark
|
|
183
158
|
|
|
184
159
|
```swift
|
|
185
|
-
RuleMark(y: .value("
|
|
160
|
+
RuleMark(y: .value("On-time target", 85))
|
|
186
161
|
.foregroundStyle(.red)
|
|
187
162
|
```
|
|
188
163
|
|
|
189
|
-
### SectorMark
|
|
164
|
+
### SectorMark (iOS 17+)
|
|
190
165
|
|
|
191
|
-
|
|
166
|
+
Pie and donut charts. An `innerRadius` hollows the pie into a donut; `angularInset` leaves a gap between slices.
|
|
192
167
|
|
|
193
168
|
```swift
|
|
194
|
-
Chart(
|
|
169
|
+
Chart(cabinMix) { cabin in
|
|
195
170
|
SectorMark(
|
|
196
|
-
angle: .value("
|
|
197
|
-
innerRadius: .ratio(0.
|
|
198
|
-
angularInset:
|
|
171
|
+
angle: .value("Seats", cabin.seatCount),
|
|
172
|
+
innerRadius: .ratio(0.55),
|
|
173
|
+
angularInset: 1.5
|
|
199
174
|
)
|
|
200
|
-
.foregroundStyle(by: .value("
|
|
175
|
+
.foregroundStyle(by: .value("Cabin", cabin.name))
|
|
201
176
|
}
|
|
202
177
|
```
|
|
203
178
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
### Plot Types (iOS 18+)
|
|
179
|
+
### Plot types (iOS 18+)
|
|
207
180
|
|
|
208
|
-
iOS 18 adds
|
|
209
|
-
|
|
210
|
-
`LinePlot` and `AreaPlot` also accept function closures for plotting mathematical functions without discrete data:
|
|
181
|
+
iOS 18 adds collection-level wrappers over the same families, named after them: `SectorPlot`, `RulePlot`, `RectanglePlot`, `PointPlot`, `LinePlot`, `BarPlot`, `AreaPlot`. Choose them when you prefer a collection-oriented API or want to plot a function. `LinePlot` and `AreaPlot` accept a closure and draw a mathematical function with no discrete data:
|
|
211
182
|
|
|
212
183
|
```swift
|
|
213
184
|
if #available(iOS 18, *) {
|
|
214
185
|
Chart {
|
|
215
|
-
|
|
216
|
-
|
|
186
|
+
// function plot, no data collection
|
|
187
|
+
LinePlot(x: "t", y: "damped") { t in
|
|
188
|
+
exp(-t / 4) * cos(t)
|
|
217
189
|
}
|
|
218
190
|
}
|
|
219
|
-
.chartXScale(domain:
|
|
220
|
-
.chartYScale(domain: -1.
|
|
191
|
+
.chartXScale(domain: 0 ... 12)
|
|
192
|
+
.chartYScale(domain: -1.2 ... 1.2)
|
|
221
193
|
}
|
|
222
194
|
```
|
|
223
195
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
### Chart3D (iOS 26+)
|
|
196
|
+
## Chart3D (iOS 26+)
|
|
227
197
|
|
|
228
|
-
`Chart3D` is
|
|
198
|
+
`Chart3D` is its own container for three-dimensional content. It accepts 3D `PointMark`, `RectangleMark` and `RuleMark`, plus `SurfacePlot`. It does not exist before iOS 26, so it must always sit behind `#available(iOS 26, *)`.
|
|
229
199
|
|
|
230
200
|
```swift
|
|
231
201
|
if #available(iOS 26, *) {
|
|
232
|
-
|
|
202
|
+
// scatter in three axes
|
|
203
|
+
Chart3D(sensorSamples) { sample in
|
|
233
204
|
PointMark(
|
|
234
|
-
x: .value("
|
|
235
|
-
y: .value("
|
|
236
|
-
z: .value("
|
|
205
|
+
x: .value("Latitude", sample.latitude),
|
|
206
|
+
y: .value("Altitude", sample.altitude),
|
|
207
|
+
z: .value("Longitude", sample.longitude)
|
|
237
208
|
)
|
|
238
209
|
}
|
|
239
210
|
.chart3DPose(.front)
|
|
@@ -241,379 +212,348 @@ if #available(iOS 26, *) {
|
|
|
241
212
|
}
|
|
242
213
|
```
|
|
243
214
|
|
|
244
|
-
`SurfacePlot`
|
|
215
|
+
`SurfacePlot` evaluates a function of two variables and draws the resulting surface:
|
|
245
216
|
|
|
246
217
|
```swift
|
|
247
218
|
if #available(iOS 26, *) {
|
|
248
219
|
Chart3D {
|
|
249
|
-
|
|
250
|
-
|
|
220
|
+
// height comes from the closure
|
|
221
|
+
SurfacePlot(x: "x", y: "lift", z: "z") { x, z in
|
|
222
|
+
cos(x) * sin(z)
|
|
251
223
|
}
|
|
252
224
|
}
|
|
253
|
-
.chartXScale(domain: -
|
|
254
|
-
.chartZScale(domain: -
|
|
225
|
+
.chartXScale(domain: -3.0 ... 3.0)
|
|
226
|
+
.chartZScale(domain: -3.0 ... 3.0)
|
|
255
227
|
}
|
|
256
228
|
```
|
|
257
229
|
|
|
258
|
-
Camera
|
|
230
|
+
Camera options:
|
|
259
231
|
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
- On visionOS,
|
|
232
|
+
- Projection: `.chart3DCameraProjection(.orthographic)` is the default and keeps measurements exact; `.perspective` adds depth.
|
|
233
|
+
- Preset poses: `.front`, `.back`, `.left`, `.right` or `.default`, each passed to `.chart3DPose(_:)`.
|
|
234
|
+
- Arbitrary pose: build a `Chart3DPose` from an azimuth and an inclination and pass it in, for example `.chart3DPose(Chart3DPose(azimuth: .degrees(60), inclination: .degrees(20)))`. A `Binding<Chart3DPose>` overload lets the pose follow state.
|
|
235
|
+
- On visionOS, people can rotate and explore a `Chart3D` with the platform's 3D gestures.
|
|
264
236
|
|
|
265
|
-
|
|
237
|
+
## Axes
|
|
266
238
|
|
|
267
|
-
|
|
239
|
+
### Visibility and titles
|
|
268
240
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
Use `chartXAxis`, `chartYAxis`, `chartXAxisLabel`, and `chartYAxisLabel` on the `Chart` container.
|
|
272
|
-
Axis visibility supports `.automatic`, `.visible`, and `.hidden`.
|
|
241
|
+
`chartXAxis`, `chartYAxis`, `chartXAxisLabel` and `chartYAxisLabel` go on the `Chart`. Visibility is `.automatic`, `.visible` or `.hidden`.
|
|
273
242
|
|
|
274
243
|
```swift
|
|
275
|
-
Chart(
|
|
244
|
+
Chart(monthlyDelays) { month in
|
|
276
245
|
BarMark(
|
|
277
|
-
x: .value("Month",
|
|
278
|
-
y: .value("
|
|
246
|
+
x: .value("Month", month.name),
|
|
247
|
+
y: .value("Delayed flights", month.count)
|
|
279
248
|
)
|
|
280
249
|
}
|
|
281
|
-
.
|
|
282
|
-
.chartYAxis(.hidden)
|
|
250
|
+
.chartYAxisLabel("Delayed flights")
|
|
283
251
|
.chartXAxisLabel("Month")
|
|
284
|
-
.
|
|
252
|
+
.chartYAxis(.hidden)
|
|
253
|
+
.chartXAxis(.visible)
|
|
285
254
|
```
|
|
286
255
|
|
|
287
|
-
###
|
|
256
|
+
### AxisMarks
|
|
288
257
|
|
|
289
|
-
|
|
258
|
+
`AxisMarks` controls where ticks sit, how values are labelled and whether grid lines show. Inside it, combine `AxisGridLine()`, `AxisTick()` and `AxisValueLabel()` as needed.
|
|
290
259
|
|
|
291
260
|
```swift
|
|
292
|
-
Chart(
|
|
261
|
+
Chart(dailyBookings) { day in
|
|
293
262
|
LineMark(
|
|
294
|
-
x: .value("
|
|
295
|
-
y: .value("
|
|
263
|
+
x: .value("Travel date", day.date),
|
|
264
|
+
y: .value("Bookings made", day.count)
|
|
296
265
|
)
|
|
297
266
|
}
|
|
298
267
|
.chartXAxis {
|
|
299
268
|
AxisMarks(
|
|
300
|
-
preset: .
|
|
301
|
-
position: .
|
|
302
|
-
values: .stride(by: .
|
|
269
|
+
preset: .inset,
|
|
270
|
+
position: .top,
|
|
271
|
+
values: .stride(by: .weekOfYear)
|
|
303
272
|
) {
|
|
304
|
-
|
|
273
|
+
AxisValueLabel(format: .dateTime.month(.abbreviated).day())
|
|
305
274
|
AxisTick(length: .label)
|
|
306
|
-
|
|
275
|
+
AxisGridLine()
|
|
307
276
|
}
|
|
308
277
|
}
|
|
309
278
|
```
|
|
310
279
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
- `preset`: `.automatic`, `.extended`, `.aligned`, `.inset`
|
|
314
|
-
- `position`: `.automatic`, `.leading`, `.trailing`, `.top`, `.bottom`
|
|
315
|
-
- `values`: `.automatic`, `.automatic(desiredCount:)`, `.stride(by:)`, `.stride(by:count:)`, or an explicit array
|
|
280
|
+
`AxisMarks` parameters:
|
|
316
281
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
AxisGridLine()
|
|
323
|
-
AxisTick()
|
|
324
|
-
AxisValueLabel()
|
|
325
|
-
```
|
|
282
|
+
| Parameter | Options |
|
|
283
|
+
|-----------|---------|
|
|
284
|
+
| `preset` | `.inset`, `.aligned`, `.extended` or `.automatic` |
|
|
285
|
+
| `position` | edges `.top`, `.bottom`, `.leading`, `.trailing`, or `.automatic` |
|
|
286
|
+
| `values` | an explicit array, `.stride(by:)` and `.stride(by:count:)`, or `.automatic` with or without `desiredCount:` |
|
|
326
287
|
|
|
327
|
-
|
|
288
|
+
For crowded axes, tune `AxisValueLabel`:
|
|
328
289
|
|
|
329
290
|
```swift
|
|
330
291
|
AxisValueLabel(
|
|
331
|
-
collisionResolution: .greedy(minimumSpacing:
|
|
332
|
-
orientation: .
|
|
292
|
+
collisionResolution: .greedy(minimumSpacing: 12),
|
|
293
|
+
orientation: .verticalReversed
|
|
333
294
|
)
|
|
334
295
|
```
|
|
335
296
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
Collision strategies: `.automatic`, `.greedy`, `.greedy(priority:minimumSpacing:)`, `.truncate`, `.disabled`.
|
|
297
|
+
- Orientation: `.automatic`, `.horizontal`, `.vertical`, `.verticalReversed`.
|
|
298
|
+
- Collision resolution: `.disabled`, `.truncate`, `.greedy`, the tunable `.greedy(priority:minimumSpacing:)`, or `.automatic`.
|
|
339
299
|
|
|
340
|
-
###
|
|
300
|
+
### Scales and the plot area
|
|
341
301
|
|
|
342
|
-
|
|
302
|
+
Set an explicit domain with `chartXScale` / `chartYScale` and style the plot area with `chartPlotStyle`. Each axis can be fixed independently, for example only `.chartXScale(domain: firstDay...lastDay)`.
|
|
343
303
|
|
|
344
304
|
```swift
|
|
345
|
-
Chart(
|
|
305
|
+
Chart(scores) { entry in
|
|
346
306
|
LineMark(
|
|
347
|
-
x: .value("
|
|
348
|
-
y: .value("
|
|
307
|
+
x: .value("Survey round", entry.round),
|
|
308
|
+
y: .value("Satisfaction", entry.score)
|
|
349
309
|
)
|
|
350
310
|
}
|
|
351
|
-
.
|
|
352
|
-
.
|
|
353
|
-
.chartPlotStyle {
|
|
354
|
-
|
|
355
|
-
.background(.gray.opacity(0.08))
|
|
311
|
+
.chartYScale(domain: 0...10)
|
|
312
|
+
.chartXScale(domain: 1...12)
|
|
313
|
+
.chartPlotStyle { plot in
|
|
314
|
+
plot.background(.gray.opacity(0.08))
|
|
356
315
|
}
|
|
357
316
|
```
|
|
358
317
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
```swift
|
|
362
|
-
.chartXScale(domain: startDate...endDate)
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
### Scrollable Axes (iOS 17+)
|
|
318
|
+
### Scrolling (iOS 17+)
|
|
366
319
|
|
|
367
|
-
For
|
|
320
|
+
For long series, let the plot scroll and choose how much is visible at once.
|
|
368
321
|
|
|
369
322
|
```swift
|
|
370
|
-
@State private var
|
|
323
|
+
@State private var firstVisibleDay = 0
|
|
371
324
|
|
|
372
|
-
Chart(
|
|
325
|
+
Chart(dailyLoad) { day in
|
|
373
326
|
BarMark(
|
|
374
|
-
x: .value("Day",
|
|
375
|
-
y: .value("
|
|
327
|
+
x: .value("Day", day.index),
|
|
328
|
+
y: .value("Load factor", day.loadFactor)
|
|
376
329
|
)
|
|
377
330
|
}
|
|
331
|
+
.chartScrollPosition(x: $firstVisibleDay)
|
|
332
|
+
.chartXVisibleDomain(length: 14)
|
|
378
333
|
.chartScrollableAxes(.horizontal)
|
|
379
|
-
.chartXVisibleDomain(length: 7)
|
|
380
|
-
.chartScrollPosition(x: $scrollX)
|
|
381
334
|
```
|
|
382
335
|
|
|
383
|
-
## Selection
|
|
336
|
+
## Selection (iOS 17+)
|
|
337
|
+
|
|
338
|
+
Selection modifiers bind to the **plottable value** under the finger, not to your model element. Look the record up yourself when you need it.
|
|
384
339
|
|
|
385
|
-
###
|
|
340
|
+
### One value
|
|
386
341
|
|
|
387
|
-
|
|
342
|
+
`chartXSelection(value:)` or `chartYSelection(value:)`:
|
|
388
343
|
|
|
389
344
|
```swift
|
|
390
|
-
@State private var
|
|
345
|
+
@State private var inspectedDate: Date?
|
|
391
346
|
|
|
392
|
-
Chart(
|
|
393
|
-
LineMark(x: .value("
|
|
347
|
+
Chart(dailyBookings) { day in
|
|
348
|
+
LineMark(x: .value("Travel date", day.date), y: .value("Bookings made", day.count))
|
|
394
349
|
|
|
395
|
-
if let
|
|
396
|
-
RuleMark(x: .value("
|
|
350
|
+
if let inspectedDate {
|
|
351
|
+
RuleMark(x: .value("Inspected date", inspectedDate))
|
|
397
352
|
.foregroundStyle(.secondary)
|
|
398
353
|
}
|
|
399
354
|
}
|
|
400
|
-
.chartXSelection(value: $
|
|
355
|
+
.chartXSelection(value: $inspectedDate)
|
|
401
356
|
```
|
|
402
357
|
|
|
403
|
-
###
|
|
358
|
+
### A range
|
|
404
359
|
|
|
405
|
-
|
|
360
|
+
`chartXSelection(range:)` or `chartYSelection(range:)` bind to a `ClosedRange` of the same type as the axis values. Use a range when people should brush a span, for a zoom window, a comparison or a grouped total; use `value:` when one point is enough.
|
|
406
361
|
|
|
407
362
|
```swift
|
|
408
|
-
@State private var
|
|
363
|
+
@State private var brushedQuarters: ClosedRange<Int>?
|
|
409
364
|
|
|
410
|
-
Chart(
|
|
411
|
-
BarMark(x: .value("
|
|
365
|
+
Chart(quarters) { quarter in
|
|
366
|
+
BarMark(x: .value("Quarter", quarter.index), y: .value("Revenue", quarter.revenue))
|
|
412
367
|
}
|
|
413
|
-
.chartXSelection(range: $
|
|
368
|
+
.chartXSelection(range: $brushedQuarters)
|
|
414
369
|
```
|
|
415
370
|
|
|
416
|
-
###
|
|
371
|
+
### An angle
|
|
417
372
|
|
|
418
|
-
|
|
419
|
-
- Use `range:` bindings when users should brush a span (for zoom windows, comparisons, or grouped summaries).
|
|
420
|
-
|
|
421
|
-
### Angle Selection
|
|
422
|
-
|
|
423
|
-
Use `chartAngleSelection(value:)` with `SectorMark` charts. No built-in range overload for angle selection.
|
|
373
|
+
Sector charts use `chartAngleSelection(value:)`. There is no range variant for angles; range selection exists only on the X and Y axes.
|
|
424
374
|
|
|
425
375
|
```swift
|
|
426
|
-
@State private var
|
|
376
|
+
@State private var selectedSeats: Int?
|
|
427
377
|
|
|
428
|
-
Chart(
|
|
429
|
-
SectorMark(angle: .value("
|
|
430
|
-
.foregroundStyle(by: .value("
|
|
378
|
+
Chart(cabinMix) { cabin in
|
|
379
|
+
SectorMark(angle: .value("Seats", cabin.seatCount))
|
|
380
|
+
.foregroundStyle(by: .value("Cabin", cabin.name))
|
|
431
381
|
}
|
|
432
|
-
.chartAngleSelection(value: $
|
|
382
|
+
.chartAngleSelection(value: $selectedSeats)
|
|
433
383
|
```
|
|
434
384
|
|
|
435
|
-
**Important**: Selection bindings return the plottable axis value, not the full data element. Map back to your model if you need the selected record.
|
|
436
|
-
|
|
437
385
|
## Annotations
|
|
438
386
|
|
|
439
|
-
|
|
387
|
+
Call `annotation(position:)` on a mark to pin a view to it. It suits direct labels, callouts on the selected point, notes on thresholds and summaries. Positions you will use most: `.top`, `.trailing`, `.bottom`, `.leading`, `.overlay`.
|
|
440
388
|
|
|
441
389
|
```swift
|
|
442
390
|
BarMark(
|
|
443
|
-
x: .value("
|
|
444
|
-
y: .value("
|
|
391
|
+
x: .value("Airport", hub.code),
|
|
392
|
+
y: .value("Departures", hub.departures)
|
|
445
393
|
)
|
|
446
394
|
.annotation(position: .top) {
|
|
447
|
-
Text(
|
|
395
|
+
Text(hub.departures, format: .number)
|
|
448
396
|
}
|
|
449
397
|
```
|
|
450
398
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
## ChartProxy and Custom Touch Handling
|
|
399
|
+
## Custom Gestures with ChartProxy
|
|
454
400
|
|
|
455
|
-
|
|
401
|
+
Go lower than the selection modifiers by reading a `ChartProxy`. You receive one in `chartGesture` (iOS 17+) and in `chartBackground` or `chartOverlay` (iOS 16+). The plot area anchor is `proxy.plotFrame` on iOS 17+ and `proxy.plotAreaFrame` on iOS 16.
|
|
456
402
|
|
|
457
403
|
```swift
|
|
458
404
|
.chartOverlay { proxy in
|
|
459
|
-
GeometryReader {
|
|
460
|
-
|
|
461
|
-
.
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
405
|
+
GeometryReader { container in
|
|
406
|
+
let scrub = DragGesture(minimumDistance: 0)
|
|
407
|
+
.onChanged { drag in
|
|
408
|
+
// iOS 16: read proxy.plotAreaFrame instead
|
|
409
|
+
guard let anchor = proxy.plotFrame else { return }
|
|
410
|
+
let plotRect = container[anchor]
|
|
411
|
+
let localX = drag.location.x - plotRect.minX
|
|
412
|
+
guard (0...plotRect.width).contains(localX) else { return }
|
|
413
|
+
inspectedDate = proxy.value(atX: localX, as: Date.self)
|
|
414
|
+
}
|
|
415
|
+
.onEnded { _ in inspectedDate = nil }
|
|
416
|
+
|
|
417
|
+
Color.clear
|
|
418
|
+
.contentShape(Rectangle())
|
|
419
|
+
.gesture(scrub)
|
|
472
420
|
}
|
|
473
421
|
}
|
|
474
422
|
```
|
|
475
423
|
|
|
476
|
-
|
|
424
|
+
What the proxy offers:
|
|
477
425
|
|
|
478
|
-
|
|
426
|
+
| Need | API |
|
|
427
|
+
|------|-----|
|
|
428
|
+
| screen point to data value | `value(at:as:)` for a point, or per axis `value(atX:as:)` / `value(atY:as:)` |
|
|
429
|
+
| data value to screen point, for custom indicators | `position(forX:)`, `position(forY:)`, `position(for:)` |
|
|
430
|
+
| drive built-in selection from your own gesture (iOS 17+) | single values with `selectXValue(at:)` / `selectYValue(at:)`, spans with `selectXRange(from:to:)` / `selectYRange(from:to:)` |
|
|
431
|
+
| plot geometry | `plotSize`, plus the anchor `plotFrame` on iOS 17+ (`plotAreaFrame` on iOS 16) |
|
|
479
432
|
|
|
480
|
-
|
|
481
|
-
- `position(forX:)`, `position(forY:)`, and `position(for:)` for placing custom overlays or indicators
|
|
482
|
-
- `selectXValue(at:)`, `selectYValue(at:)`, `selectXRange(from:to:)`, and `selectYRange(from:to:)` for driving built-in selection from custom gestures
|
|
483
|
-
- `plotFrame` (iOS 17+) or `plotAreaFrame` (iOS 16) with `plotSize` for converting between gesture coordinates and the plot area
|
|
433
|
+
The `select*` methods and `chartGesture` need iOS 17.
|
|
484
434
|
|
|
485
|
-
|
|
435
|
+
## Where Modifiers Go
|
|
486
436
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
Apply chart-wide modifiers to the `Chart` container and mark-specific modifiers to the individual mark.
|
|
437
|
+
Chart-wide modifiers (axes, scales, selection, plot style, legend) belong on the `Chart`. Mark modifiers (interpolation, symbol, annotation) belong on the mark.
|
|
490
438
|
|
|
491
439
|
```swift
|
|
492
|
-
Chart(
|
|
440
|
+
Chart(altitudeSamples) { sample in
|
|
493
441
|
LineMark(
|
|
494
|
-
x: .value("
|
|
495
|
-
y: .value("
|
|
442
|
+
x: .value("Time", sample.time),
|
|
443
|
+
y: .value("Altitude", sample.altitude)
|
|
496
444
|
)
|
|
497
|
-
.interpolationMethod(.monotone)
|
|
445
|
+
.interpolationMethod(.monotone)
|
|
498
446
|
}
|
|
499
|
-
.chartXAxis { AxisMarks() }
|
|
500
|
-
.chartYScale(domain: 0...100)
|
|
447
|
+
.chartXAxis { AxisMarks() }
|
|
448
|
+
.chartYScale(domain: 0...100)
|
|
501
449
|
.chartPlotStyle { $0.background(.thinMaterial) }
|
|
502
450
|
```
|
|
503
451
|
|
|
504
|
-
##
|
|
452
|
+
## Visual Channels
|
|
505
453
|
|
|
506
|
-
###
|
|
454
|
+
### Colour by category
|
|
507
455
|
|
|
508
|
-
|
|
456
|
+
`foregroundStyle(by: .value(...))` assigns colours from a data property and produces the legend for free. Hard-coding `.foregroundStyle(.red)` on each mark for categorical data removes the legend and hurts accessibility.
|
|
509
457
|
|
|
510
458
|
```swift
|
|
511
|
-
Chart(
|
|
459
|
+
Chart(loadByAlliance) { entry in
|
|
512
460
|
BarMark(
|
|
513
|
-
x: .value("Month",
|
|
514
|
-
y: .value("
|
|
461
|
+
x: .value("Month", entry.month),
|
|
462
|
+
y: .value("Passengers", entry.passengers)
|
|
515
463
|
)
|
|
516
|
-
.foregroundStyle(by: .value("
|
|
464
|
+
.foregroundStyle(by: .value("Alliance", entry.alliance))
|
|
517
465
|
}
|
|
518
466
|
```
|
|
519
467
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
### Custom Color Scales
|
|
468
|
+
### Choosing the colours
|
|
523
469
|
|
|
524
|
-
|
|
470
|
+
Map values to colours with `chartForegroundStyleScale`. When series come and go across the data, use the overload that takes a domain and a mapping closure.
|
|
525
471
|
|
|
526
472
|
```swift
|
|
527
473
|
.chartForegroundStyleScale([
|
|
528
|
-
"
|
|
529
|
-
"
|
|
530
|
-
"
|
|
474
|
+
"Economy": .teal,
|
|
475
|
+
"Business": .indigo,
|
|
476
|
+
"First": .orange
|
|
531
477
|
])
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
For dynamic data where not all series appear at every point, use the mapping overload:
|
|
535
478
|
|
|
536
|
-
|
|
537
|
-
.
|
|
538
|
-
colorForRegion(region)
|
|
479
|
+
.chartForegroundStyleScale(domain: cabinNames, mapping: { cabin in
|
|
480
|
+
palette.color(for: cabin)
|
|
539
481
|
})
|
|
540
482
|
```
|
|
541
483
|
|
|
542
|
-
### Symbol and
|
|
484
|
+
### Symbol and size
|
|
543
485
|
|
|
544
|
-
|
|
486
|
+
On a `PointMark` or a `LineMark`, `symbol(by:)` and `symbolSize(by:)` add further data dimensions as shape and size.
|
|
545
487
|
|
|
546
488
|
```swift
|
|
547
|
-
Chart(
|
|
489
|
+
Chart(routes) { route in
|
|
548
490
|
PointMark(
|
|
549
|
-
x: .value("
|
|
550
|
-
y: .value("
|
|
491
|
+
x: .value("Distance", route.distance),
|
|
492
|
+
y: .value("Fare", route.fare)
|
|
551
493
|
)
|
|
552
|
-
.foregroundStyle(by: .value("
|
|
553
|
-
.symbol(by: .value("
|
|
554
|
-
.symbolSize(by: .value("
|
|
494
|
+
.foregroundStyle(by: .value("Carrier", route.carrier))
|
|
495
|
+
.symbol(by: .value("Carrier", route.carrier))
|
|
496
|
+
.symbolSize(by: .value("Weekly frequency", route.frequency))
|
|
555
497
|
}
|
|
556
498
|
```
|
|
557
499
|
|
|
558
|
-
### Legend
|
|
500
|
+
### Legend
|
|
559
501
|
|
|
560
502
|
```swift
|
|
561
|
-
.chartLegend(.
|
|
503
|
+
.chartLegend(position: .top, alignment: .leading)
|
|
562
504
|
.chartLegend(.hidden)
|
|
563
|
-
.chartLegend(
|
|
505
|
+
.chartLegend(.visible)
|
|
564
506
|
```
|
|
565
507
|
|
|
566
|
-
##
|
|
508
|
+
## Layering Marks
|
|
567
509
|
|
|
568
|
-
|
|
510
|
+
Several mark types can share one `Chart` closure, for example points on top of a line, or a dashed target rule over bars.
|
|
569
511
|
|
|
570
512
|
```swift
|
|
571
|
-
|
|
572
|
-
LineMark(x: .value("
|
|
573
|
-
|
|
574
|
-
PointMark(x: .value("
|
|
513
|
+
Chart(gateWaits) { wait in
|
|
514
|
+
LineMark(x: .value("Time of day", wait.time), y: .value("Queue minutes", wait.minutes))
|
|
515
|
+
.interpolationMethod(.monotone)
|
|
516
|
+
PointMark(x: .value("Time of day", wait.time), y: .value("Queue minutes", wait.minutes))
|
|
517
|
+
}
|
|
575
518
|
|
|
576
|
-
|
|
577
|
-
BarMark(x: .value("Month",
|
|
578
|
-
RuleMark(y: .value("
|
|
579
|
-
|
|
580
|
-
|
|
519
|
+
Chart(monthlyRevenue) { month in
|
|
520
|
+
BarMark(x: .value("Month", month.name), y: .value("Revenue", month.amount))
|
|
521
|
+
RuleMark(y: .value("Budget", 12_000))
|
|
522
|
+
.lineStyle(StrokeStyle(lineWidth: 1.5, dash: [6, 4]))
|
|
523
|
+
.foregroundStyle(.orange)
|
|
524
|
+
}
|
|
581
525
|
```
|
|
582
526
|
|
|
583
|
-
## Animating
|
|
527
|
+
## Animating Data Changes
|
|
584
528
|
|
|
585
|
-
|
|
529
|
+
Marks animate on their own when the change happens inside an animation and the elements keep stable identity, which is why `Identifiable` (or `id:`) is required for animated charts: it lets Swift Charts pair old and new points.
|
|
586
530
|
|
|
587
531
|
```swift
|
|
588
532
|
withAnimation(.easeInOut) {
|
|
589
|
-
|
|
533
|
+
visibleSeries = filteredSeries
|
|
590
534
|
}
|
|
591
535
|
```
|
|
592
536
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
-
|
|
600
|
-
-
|
|
601
|
-
-
|
|
602
|
-
-
|
|
603
|
-
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
-
|
|
611
|
-
-
|
|
612
|
-
-
|
|
613
|
-
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
- Assume selection returns a model object; it only returns the plottable axis value
|
|
617
|
-
- Forget that range selection is available only for X and Y axes, not angle selection
|
|
618
|
-
|
|
619
|
-
For chart accessibility (VoiceOver, Audio Graph, `AXChartDescriptorRepresentable`), fallback strategies, WWDC sessions, and a full summary checklist, see `charts-accessibility.md`.
|
|
537
|
+
## Guidelines
|
|
538
|
+
|
|
539
|
+
Do:
|
|
540
|
+
- write descriptive `.value` labels; axes and VoiceOver read them
|
|
541
|
+
- give chart data stable identity with `Identifiable` or `id:`
|
|
542
|
+
- colour categorical series with `foregroundStyle(by:)` to get a legend and accessible series
|
|
543
|
+
- draw targets, limits and the current selection with `RuleMark`
|
|
544
|
+
- pass explicit `AxisMarks(values:)` when automatic ticks crowd
|
|
545
|
+
- fix domains with `chartXScale` / `chartYScale` when charts must compare visually
|
|
546
|
+
- brush with `chartXSelection(range:)` or `chartYSelection(range:)`
|
|
547
|
+
- wrap `SectorMark`, selection and other iOS 17+ APIs in `#available`
|
|
548
|
+
|
|
549
|
+
Avoid:
|
|
550
|
+
- attaching `chartXAxis`, `chartXSelection` or other chart-wide modifiers to one mark
|
|
551
|
+
- per-mark hard-coded colours for categories
|
|
552
|
+
- identities that shift when points get added, deleted or moved
|
|
553
|
+
- strings for values that are really numbers or dates, unless categorical behaviour is wanted
|
|
554
|
+
- stacking unrelated series just because `BarMark` and `AreaMark` stack by default
|
|
555
|
+
- forcing every tick label to show when collision handling or a stride reads better
|
|
556
|
+
- treating a selection binding as a model object; it is only the plottable value
|
|
557
|
+
- looking for range selection on angles; it exists only for X and Y
|
|
558
|
+
|
|
559
|
+
VoiceOver, Audio Graph, `AXChartDescriptorRepresentable`, version fallbacks, session links and the full checklist: `charts-accessibility.md`.
|