How to Add Charts to an iPhone App With Swift Charts (2026)
Add charts to an iPhone app without code: bar, line, area and ring charts with Apple's Swift Charts, which chart fits which data, and the steps in Borel.

By Sigsten Gustavii· · 8 min read
To add charts to an iPhone app, decide the one question each chart answers, choose the chart type that answers it, feed it from the app's own data, keep it readable at phone size, and let people tap for exact values. With Borel, you describe the chart in a sentence and it writes it with Apple's Swift Charts.
| Question | Chart | Example |
|---|---|---|
| How has it changed over time? | Line or area | Body weight as a 7-day average |
| Which is bigger? | Bar | Spending per category this month |
| What happened each day? | Bar by day | Steps per day this week |
| What share of the whole? | Ring (donut) | Where this month's money went |
| Is there a pattern? | Points | Sleep hours against mood |
| Am I on target? | Bar or line with a target line | Water today against a goal |
Charts turn an app from a list of entries into something that shows progress, which is why people keep using it. A workout log that draws your heaviest lift over twelve weeks, a budget that shows where the money went, a habit tracker with a week of bars: each one makes the effort of logging feel worth it.
Why Swift Charts
Apple's Swift Charts draws charts as SwiftUI views, not pictures. That brings native advantages a web chart library struggles to match on iPhone:
- It redraws by itself when the data changes: log a workout and the line moves.
- It follows the iPhone's look: light and dark mode, the app's colours, Dynamic Type for labels.
- It is accessible: Swift Charts works with VoiceOver, including Audio Graphs that let someone hear the shape of a chart.
- It is fast and smooth, animated by SwiftUI.
- It is plain Swift in your project, readable if you download the code.
Chart types Borel builds
| Mark | Draws | Good for |
|---|---|---|
| BarMark | Bars | Comparisons and counts per day |
| LineMark | Lines | Trends over time |
| AreaMark | Filled areas | Totals over time |
| PointMark | Points | Patterns between two numbers |
| RuleMark | A straight line | Targets and averages |
| SectorMark | Rings and pies (iOS 17) | Shares of a whole |
Marks can be combined: bars for each day with a rule for the daily goal, or a line with points on it. Borel's charts page shows a real ring chart from Spendly, an expense tracker Borel built.
Where the numbers come from
A chart is only as good as its data. In a Borel app, a chart reads the same data as the app's lists: from SwiftData on the phone for personal apps, or from Borel Cloud for shared ones, such as a team's sales or a class's quiz scores. Totals the chart needs, like spending per category, are worked out from the entries, so there is nothing to keep in step by hand. If the numbers come from an outside service, such as a market-data feed, add its key under Tools, in Keys, and Borel fetches it through its server.
Say how the numbers should be grouped, because that is where most charts go wrong. "Per day" needs a rule for days with nothing logged (show zero, or skip them); "per week" needs a start day; "per month" needs to handle a month still in progress. A sentence like "weeks start on Monday, empty days count as zero" saves a round of changes later, and Borel works the totals out from the entries the same way every time.
Designing charts for a phone screen
- One question per chart. Two small charts beat one crowded one.
- A sensible range. Default to this week or this month, with a picker for more.
- Few labels. Phone screens are narrow; label the axis ends and let people tap for exact values.
- Tap for values. Swift Charts can highlight the value under a finger; ask for it.
- Colour with meaning. One colour per category, kept the same everywhere in the app.
- An empty state. Before there is data, explain what will appear instead of drawing an empty frame.
Apple's Human Interface Guidelines for charts cover the same ground in more depth.
Chart ideas by kind of app
| App | Chart | Built from |
|---|---|---|
| Budget | Ring of spending by category, bars by day | Expenses |
| Workout log | Line of heaviest lift per exercise | Sets |
| Habit tracker | Bars of habits done per week | Check-ins |
| Mood journal | Points of mood per day | Entries |
| Step counter | Bars of steps per day | The iPhone's motion sensors |
| Coaching app | A client's progress over a term | Logs in the cloud |
| Small business | Orders per day against last week | Orders in the cloud |
See Borel's real budget app and workout log builds for examples.
Common chart mistakes
- Too many series. Eight coloured lines on a phone are a tangle; show the top three and group the rest as Other.
- Pies for everything. Rings show shares of a whole well, but comparing ten slices is hard; use bars for that.
- A misleading axis. A bar chart that doesn't start at zero exaggerates small differences.
- Raw daily noise. Body weight or mood jumps day to day; a 7-day average shows the trend people care about.
- Mixed units. Kilometres and minutes on one axis mislead; give each its own chart.
- No context. A number with nothing to compare against says little; add last week, a goal or an average.
A sentence above every chart
The most useful line in many apps is the sentence above the chart: "You walked 18% more than last week" or "Groceries were your biggest spend this month". It can be worked out on the phone from the same numbers, with no AI and no connection. For a friendlier summary of a whole month, an app can ask Borel AI to write two lines from the totals, with the consent Apple requires before data goes to an AI; see how to add AI to an iPhone app. Either way, the chart shows the shape and the sentence tells the story.
Accessibility
A chart that only works for people who can see it well excludes many. Swift Charts gives people who use VoiceOver a description of each chart and Audio Graphs, which play the shape of the data as sound. Add a short sentence above each chart that says what it shows ("You spent most on groceries this month"), so the point is clear even without looking at the chart.
Testing charts
Charts draw in Borel's iOS Simulator in your browser, so you can check them as you build. Test with no data, one entry and a year of entries, in light and dark mode, and with the largest text size. On your iPhone, with Borel Companion on Pro, check how they feel with real numbers.
How to choose the right way to add charts
- Borel, if you want native Swift Charts from a sentence, reading the app's own data.
- Swift Charts by hand in Xcode, if you are a Swift developer who wants full control over marks and styling.
- A web chart library, if your app is a web app; on iPhone it won't follow the system look as closely.
- [CatDoes](/compare/catdoes) or [FlutterFlow](/compare/flutterflow), if you need Android; their chart options differ from Apple's.
How to do it with Borel, step by step
Step 1: Say what the chart should answer
Add an Insights tab to my budget app. Show a ring chart of this month's spending by category, with the total in the middle, and a bar chart of spending per day with a line for my daily budget. Let me tap a bar to see the exact amount. Add a picker for this month, last month and this year. Above each chart, write one sentence saying what stands out.Rivet writes the charts with Swift Charts from the app's existing data.
Step 2: Check them with real-looking data
On the live iPhone in your browser, add entries and watch the charts redraw. Try an empty month.
Step 3: Polish
Ask in plain words: "use the category colours from the list", "round amounts to whole kronor", "start the week on Monday".
Step 4: Publish
Stamp checks the app, and Publish builds and uploads it under your Apple Developer account.
The Bottom Line
Charts are what make logging feel worth it. Pick the chart by the question (lines for change, bars for comparison, rings for shares), keep each one simple at phone size, and let people tap for detail. Borel draws them with Apple's Swift Charts from your app's own data, from a single sentence. Open your app in Borel and ask for the chart you wish it had.
Questions people ask
How do I add a chart to an iPhone app?
Use Apple's Swift Charts, which draws charts as SwiftUI views. In Borel, describe the chart, such as "a bar chart of steps per day", and it writes the Swift.
Can Swift Charts draw pie charts?
Yes, since iOS 17, with SectorMark, which draws pies and rings. Borel apps target iOS 17 and up.
Do charts update when data changes?
Yes. A Swift Charts chart reads the app's data, so adding an entry redraws it straight away.
Can people tap a chart to see exact values?
Yes. Swift Charts can highlight the value under a finger; ask for it where it helps.
Are Swift Charts accessible?
Yes. They work with VoiceOver, including Audio Graphs that play a chart's shape as sound.
Can a chart use data from the cloud?
Yes. Charts can read shared data in Borel Cloud, such as a team's orders, as well as personal data on the phone.
Do I need a chart library?
No. Swift Charts is part of iOS, so a native app needs no extra library.
Which chart is right for progress over time?
A line, often with a moving average to smooth daily ups and downs, and a rule for a goal if there is one.
Can charts show steps from the iPhone?
Yes. A Borel app can count steps with the iPhone's motion sensors and chart them per day. It doesn't read Apple Health data.
Can I add charts to an app I already built with Borel?
Yes. Ask for the chart in the app's chat and Borel adds it as a new version you can roll back.
I think charts are what make logging feel worth it. Ask Borel for the chart you wish your app had.
– Sigsten
Make your iPhone app in Borel
Describe the app you want and see its first screens before you pay anything.
See your app free