swift-charts
Swift Charts
Declarative data visualization for Apple platforms. The deep API reference — every 2D mark type, plottable values, styling, axis/scale customization, legends and annotations, interactivity, and the iOS 26 Chart3D/SurfacePlot story — lives in references/guide.md. This file is the decision and discipline layer: read it first, open the guide for specifics. For everything around the chart (layout, state, navigation, view composition), use swiftui-pro.
Dials
Set these explicitly at the start; they change what "correct" means.
MARK— the primitive that matches the data's meaning:bar(category comparison) ·line/area(trend over time) ·point(distribution/correlation) ·sector(part-of-whole pie/donut) ·rule/rectangle(reference lines, heatmaps). Pick by data shape, not by what looks nice.SERIES—single(one mark, one color) ·grouped(multiple categories distinguished by.foregroundStyle(by:), optionally.position(by:)for side-by-side) ·stacked(same with stacking, the default for repeated x). Driving color by value is what generates the legend.INTERACTION—static(display only) ·selection(.chartXSelection/.chartYSelection/.chartAngleSelection, iOS 17+) ·scrolling(.chartScrollableAxes+.chartXVisibleDomain, iOS 17+). Don't reach for raw gestures when a selection modifier exists.
When to use
Building or reviewing any chart, graph, plot, or data-visualization view that uses the Charts framework — marks, axes, scales, legends, selection, scrolling, or 3D. If the work is general SwiftUI (layout, navigation, @State, view modeling) with no Charts import, use swiftui-pro.