Swift Charts with AI agents
Model the question first, then build a Chart from marks and data properties — Swift Charts will generate scales and axes that fit. Keep the chart in SwiftUI, localize and add accessibility, and only override defaults when the story needs it. Ground the agent in Apple's Charts docs before it invents a UIKit graph.
Last updated:
Apple facts are from "Swift Charts" and "Creating a chart using Swift Charts" on developer.apple.com. Tool facts are from each README. Stars as of 10 Nov 2026.
What Apple documents
Swift Charts is a SwiftUI framework for turning data into visualizations with marks, scales, axes and legends as building blocks, with minimal code.
It can build line charts, bar charts and scatter plots, among others. A new chart automatically generates scales and axes that fit the data.
Swift Charts supports localization and accessibility; you can override defaults to customize the chart.
"Creating a chart using Swift Charts": treat the chart as an answer to a question, define a data type for what you want to show, initialize a Chart view with marks and data properties, then use modifiers for the legend, axes and scale.
Rules for AGENTS.md
Code
- Use Swift Charts in SwiftUI (Chart + marks). Do not invent a UIKit graphing stack or a third-party chart API unless I ask.
- Start from a question and a typed data model; let the framework supply default axes and scales.
- Keep the chart accessible and localized; don't disable VoiceOver labels on marks.
- Look up mark and modifier names in Apple's docs before writing them.Step 1: ground the agent in Charts docs
Install Apple Docs MCP (or Sosumi) and ask it to open "Creating a chart using Swift Charts".
Step 2: model the data, then the Chart
Have the agent define the data type, an array of values, and a Chart with the appropriate marks.
Step 3: check HIG and accessibility
Run HIG Doctor on the screen; confirm the chart is readable in Dynamic Type and VoiceOver.
Step 4: tune the look only if needed
Use ui-tuning-lab on a DEBUG build to adjust spacing and motion, then bake the values in.
Tools compared (5)
| Tool | Best for | Agents (README) | Install (README) | License | Stars | Last push |
|---|---|---|---|---|---|---|
| swiftui-pro (twostraws) | Modern SwiftUI around the chart (layout, state, accessibility) | Claude Code, Cursor, Codex, Gemini | npx skills add https://github.com/twostraws/SwiftUI-Agent-Skill --skill swiftui-pro | MIT | 6507 | 26 Oct 2026 |
| Apple Docs MCP (kimsungwhee) | Search Charts and SwiftUI docs instead of inventing APIs | Claude Code, Cursor, VS Code, Windsurf | claude mcp add apple-docs -- npx -y @kimsungwhee/apple-docs-mcp@latest | MIT | 1384 | 17 Mar 2026 ⚠ |
| HIG Doctor (raintree-technology) | Audit the chart screen against Apple HIG | Claude Code, Cursor, Codex | npx hig-doctor . or npx -y hig-mcp | MIT | 153 | 3 Nov 2026 |
| Apple Platforms 27 Skills (hechen) | iOS 27-grounded platform skills around current SwiftUI | Claude Code, Cursor, Codex | npx skills add hechen/apple-platforms-27-skills --skill '*' | MIT | 2 | 27 Sep 2026 ⚠ |
| ui-tuning-lab (Mohanad-Ramadan) | Dial in spacing, motion and looks on a running SwiftUI chart screen | Claude Code, Codex, Cursor | npx skills add Mohanad-Ramadan/ui-tuning-lab | MIT | 1 | 10 Nov 2026 |
⚠ = no push in the last 4 weeks.
Which one to pick
SwiftUI around the chart → swiftui-pro. Current platform APIs → Apple Platforms 27 Skills.
Official API lookup → Apple Docs MCP. Interface audit → HIG Doctor.
Visual iteration on a running screen → ui-tuning-lab.
A prompt that keeps the agent honest
Code
Build a Swift Charts bar chart that answers "which category sold the most this week?". Define a typed data model, use Chart and marks only, keep the default axes unless a label overflows, and add VoiceOver labels. Look up any modifier in Apple's Charts docs before you use it. Do not add a third-party chart library.FAQ
- Is Swift Charts a SwiftUI framework?
- Yes. Apple describes Swift Charts as a SwiftUI framework for turning data into visualizations with marks, scales, axes and legends as building blocks.
- Do I have to configure axes myself?
- No. When you create a chart, Swift Charts automatically generates scales and axes that fit your data. Override them only when you need a custom story.
- What kinds of charts can the agent build?
- Apple documents line charts, bar charts and scatter plots, among others, by combining marks and data properties and then using modifiers for the legend, axes and scale.
- How should the agent start?
- Apple's 'Creating a chart using Swift Charts' guide says to treat the chart as an answer to a question, define a data type for what you want to show, then initialize a Chart view with marks.
- Which tool should I install first?
- swiftui-pro for modern SwiftUI around the chart, plus apple-docs-mcp or Sosumi so the agent reads the Charts framework instead of guessing APIs.