Hello Swift Charts
Description: Say hello to Swift Charts — a flexible framework that helps you create charts entirely in SwiftUI that look and feel right at home on all Apple platforms. Discover how you can use compositional syntax to make informative, delightful, and accessible charts with less code. We’ll share the building blocks for making visualizations with Swift Charts, and explore how you can change your charts’ design with a simple modifier. We’ll also take you through the latest updates to Xcode Previews to help you chart a path toward an engaging experience.
- Declarative, Compositional, like SwiftUI
- requires
import Charts
to use
Chart
Chart
is the main outside wrapperBarMark
withx
andy
positions and.value
data- first argument of value is description, second the value

- make data types
Identifiable
to use inCharts
- supports
ForEach
forIdentifiable
data collections - Implicit
forEach
via aChart
initializer taking a data collection - Charts chooses an appropriate visualization automatically
- Adapts to dynamic type, device sizes, orientations, dark mode and supports accessibility automatically
Features
- When navigation charts in VoiceOver speaks the description + value
- Supports AudioGraph feature from 2021, too (peep sounds)
- .value also accepts a
unit
for types likeDate
, e.g..day
- Supports SwiftUI animations (e.g. animate between different data collections but same bar chart view)
- Use
.foregroundStyle(by:
to group data by color → auto-generated legend for the colors - Easy to change from
BarMark
toPointMark
orLineMark
(great for prototyping charts!) - Also
.symbol(by:
a value available to use square/circle instead of color to differentiate data form each other - Marks: Bar, Point, Line
- Mark Properties: X Position, Y Position, Foreground Style, Symbol

- More Marks available:
Area
,Rule
,Rectangle
- More Mark Properties available:
Symbol Size
,Line Style


- Support for:
- Dark Mode
- Device Screen Sizes
- Dynamic Type
- Voice Over
- Audio Graphs
- High-Contrast
- Localization
- Multi-Platform