ios-charts-and-data-visualization
iOS charts & data visualization — Swift Charts, marks, and honest, accessible graphics
Source: Apple HIG Charting data + developer.apple.com Swift Charts framework reference (Chart, the Mark types, axis/scale APIs, scrolling + selection introduced WWDC24, 3D charts introduced WWDC25 / iOS 26) + SwiftUI Gauge + Swift Charts accessibility (AXChartDescriptor / Audio Graphs, WWDC21 Bring accessibility to charts); cross-checked across WWDC22/23/24/25 Swift Charts sessions and ≥2 sources per API. Currency (June 2026): iOS 26 is the shipping baseline; iOS 27 (WWDC 2026) is the current cycle. WWDC 2026 shipped no Swift Charts headline — the What's New in SwiftUI session does not mention the framework — so everything below holds unchanged through iOS 27; the only Swift-Charts-adjacent WWDC26 change is Liquid Glass v2 styling, which applies to chart container surfaces (the card/material a chart sits in), not to the marks themselves (see ios-liquid-glass-swiftui). Apple's stance: build charts from marks, scales, and axes; let the framework own the accessibility tree; keep the encoding honest. (Apple's own doc pages are JS-rendered and don't fetch to plain text — API names below are cross-checked, not pasted from a live page; confirm exact signatures on-device / in Xcode Quick Help before locking production code.)
1. Pick the mark for the intent (this is the whole game)
Choose by the question the data answers, not by what looks rich. Match the encoding to the message:
| Intent / question | Chart | Swift Charts mark |
|---|---|---|
| Trend over time ("is weight going down?") | Line, or area for one emphasized series | LineMark, AreaMark |
| Comparison across categories ("which day most calories?") | Bar (vertical) / horizontal bar | BarMark |
| Part-to-whole, few slices ("macro split today") | Stacked bar, or donut/sector | stacked BarMark, SectorMark |
| Composition over time | Stacked area / stacked bar | AreaMark(stacked), BarMark(stacked) |
| Correlation / distribution of points | Scatter | PointMark |
| Single value vs a goal ("calories left") | Gauge / ring / progress arc | SwiftUI Gauge (§7) |
| Threshold / target / average overlay | Reference line/band on any chart | RuleMark, RectangleMark |
Rules of thumb: time on X, value on Y. Bars for magnitude comparison; lines for rate/trend. Pie/donut only for 2–4 slices that sum to a meaningful whole — beyond ~5, a bar beats it every time. One primary message per chart.