6 Libraries Compared · Native + Open Source

Best SwiftUI Charts Libraries in 2026

Honest comparison of every viable SwiftUI charting option — Apple\'s native Swift Charts, DGCharts, Lightweight Charts, and when to use each.

Last updated: 2026-08-19 8 min read By Ahmed Gagan, iOS Engineer
Quick Answer

The best SwiftUI charts library for almost every iOS app in 2026 is Apple\'s native Swift Charts (iOS 16+). It\'s free, accessible, theme-aware, animates automatically, and supports line/bar/area/scatter/pie/heatmap. Reach for third-party charts (DGCharts, Lightweight Charts) only when you need iOS 15 support, candlestick / OHLC financial charts, or hyper-custom rendering.

Default pick
Apple Swift Charts (iOS 16+)
For finance / OHLC
Lightweight Charts
For iOS 15 fallback
DGCharts
Avoid
Old SwiftUICharts (deprecated)

7 Swift Charts Examples, Rendered Live

Every chart below is drawn from the same data the Swift Charts code beneath it plots. Swift Charts is Apple's own framework — iOS 16+, no dependency — and it covers almost everything an indie app needs.

Line Chart

iOS 16.0

The default for anything over time. Curved interpolation and point marks.

import Charts

struct DailyRevenue: Identifiable {
    let id = UUID()
    let day: String
    let amount: Double
}

struct LineChartView: View {
    let data: [DailyRevenue]

    var body: some View {
        Chart(data) { point in
            LineMark(
                x: .value("Day", point.day),
                y: .value("Revenue", point.amount)
            )
            .interpolationMethod(.catmullRom)   // smooth, not jagged
            .lineStyle(StrokeStyle(lineWidth: 2.5, lineCap: .round))

            PointMark(
                x: .value("Day", point.day),
                y: .value("Revenue", point.amount)
            )
            .symbolSize(60)
        }
        .foregroundStyle(Color.accentColor)
        .chartYAxis { AxisMarks(position: .leading) }
        .frame(height: 200)
    }
}

Area Chart

iOS 16.0

Line chart with a gradient fill — reads as volume rather than rate.

Chart(data) { point in
    AreaMark(
        x: .value("Day", point.day),
        y: .value("Revenue", point.amount)
    )
    .interpolationMethod(.catmullRom)
    .foregroundStyle(
        .linearGradient(
            colors: [Color.accentColor.opacity(0.5), Color.accentColor.opacity(0.02)],
            startPoint: .top,
            endPoint: .bottom
        )
    )

    LineMark(
        x: .value("Day", point.day),
        y: .value("Revenue", point.amount)
    )
    .interpolationMethod(.catmullRom)
    .foregroundStyle(Color.accentColor)
    .lineStyle(StrokeStyle(lineWidth: 2.5))
}
.frame(height: 200)

Bar Chart

iOS 16.0

Discrete categories. Opacity scaled by value adds a second channel for free.

Chart(data) { point in
    BarMark(
        x: .value("Day", point.day),
        y: .value("Revenue", point.amount)
    )
    .cornerRadius(4)
    .foregroundStyle(by: .value("Day", point.day))
}
.chartLegend(.hidden)
.chartYAxis {
    AxisMarks(position: .leading) { value in
        AxisGridLine()
        AxisValueLabel {
            if let v = value.as(Double.self) {
                Text(v, format: .currency(code: "USD").precision(.fractionLength(0)))
            }
        }
    }
}
.frame(height: 200)

Bar + Average Rule

iOS 16.0

A RuleMark baseline turns a chart into an argument — above or below target.

let average = data.map(\.amount).reduce(0, +) / Double(data.count)

Chart {
    ForEach(data) { point in
        BarMark(
            x: .value("Day", point.day),
            y: .value("Revenue", point.amount)
        )
        .cornerRadius(4)
        // Colour communicates the comparison without a legend.
        .foregroundStyle(point.amount > average ? Color.accentColor : Color.accentColor.opacity(0.35))
    }

    RuleMark(y: .value("Average", average))
        .lineStyle(StrokeStyle(lineWidth: 1.5, dash: [4, 3]))
        .foregroundStyle(.orange)
        .annotation(position: .top, alignment: .trailing) {
            Text("avg").font(.caption2).foregroundStyle(.orange)
        }
}
.frame(height: 200)

Scatter Plot

iOS 16.0

Two continuous variables, with a category driving the symbol colour.

Chart(samples) { s in
    PointMark(
        x: .value("Sessions", s.sessions),
        y: .value("Revenue", s.revenue)
    )
    .foregroundStyle(by: .value("Cohort", s.cohort))
    .symbolSize(80)
    .opacity(0.8)
}
.chartXAxis { AxisMarks(preset: .aligned) }
.frame(height: 200)

Donut Chart

iOS 17.0

SectorMark with an inner radius. iOS 17+ — gate it or fall back to bars.

// SectorMark requires iOS 17. Gate the call site, or show a
// BarMark breakdown on iOS 16.
@available(iOS 17, *)
struct SourceBreakdown: View {
    let slices: [Slice]

    var body: some View {
        Chart(slices) { slice in
            SectorMark(
                angle: .value("Share", slice.value),
                innerRadius: .ratio(0.62),      // the "donut" hole
                angularInset: 1.5
            )
            .cornerRadius(4)
            .foregroundStyle(by: .value("Source", slice.name))
        }
        .frame(height: 220)
    }
}
Revenue+34%
Churn−12%

Sparklines in a List

iOS 16.0

Tiny inline charts — axes hidden, so they read as a glyph beside a number.

struct SparklineRow: View {
    let title: String
    let values: [Double]
    let delta: String
    let isUp: Bool

    var body: some View {
        HStack(spacing: 12) {
            Text(title).font(.subheadline).foregroundStyle(.secondary)

            Chart(Array(values.enumerated()), id: \.offset) { index, value in
                LineMark(x: .value("i", index), y: .value("v", value))
                    .interpolationMethod(.catmullRom)
            }
            .foregroundStyle(isUp ? .green : .red)
            .chartXAxis(.hidden)          // a sparkline has no axes
            .chartYAxis(.hidden)
            .frame(width: 110, height: 38)

            Text(delta).font(.subheadline.weight(.semibold)).monospacedDigit()
        }
    }
}
Free download

7 Swift Charts recipes as one Swift file

Every chart above — line, area, bar, average-rule, scatter, donut and sparkline — in a single drop-in file you can paste into any iOS 16+ project.

  • All 7 charts, copy-paste ready
  • Axis, legend and annotation setup included
  • iOS 17 SectorMark gated correctly
  • MIT licensed, commercial use fine

Instant download, no confirmation step. Occasional SwiftUI tips — unsubscribe anytime.

A Swift Charts Line Chart in 10 Lines

For comparison, here's a complete time-series line chart with Apple's Swift Charts:

RevenueChart.swift
import Charts
import SwiftUI

struct RevenueChart: View {
  let data: [(date: Date, revenue: Double)]

  var body: some View {
    Chart(data, id: \.date) { point in
      LineMark(
        x: .value("Date", point.date),
        y: .value("Revenue", point.revenue)
      )
      .interpolationMethod(.catmullRom)
    }
    .chartXAxis { AxisMarks(values: .stride(by: .day, count: 7)) }
    .chartYAxis { AxisMarks(format: .currency(code: "USD")) }
  }
}

Which Charts Library Should You Choose?

Four quick rules cover almost every case:

  • Building for iOS 16+? Use Apple's native Swift Charts — it covers ~95% of apps with zero dependencies.
  • Need to support iOS 15 or older? Use DGCharts, the mature, battle-tested fallback.
  • Building a finance or trading app (candlestick, OHLC, crosshairs)? Use Lightweight Charts from TradingView.
  • Maintaining a legacy app on the old "Charts" library? Migrate to DGCharts — it is the same project, renamed.

Ship your SwiftUI app in 5 emails

A free 5-part course on the parts that actually stall launches: paywall, auth, onboarding, App Store review, and pricing. No fluff, unsubscribe anytime.

Chart-ready boilerplate.

The Swift Kit ships Swift Charts examples themed via the design system — revenue, growth, habit progress, AI usage.

Get The Swift Kit — $99

Short on time?

I can set the kit up for your app and hand back a running Xcode project — from $499. Source code still yours.

See done-for-you

The 6 Charts Libraries

Ranked by what most apps should actually use. The native option wins for ~95% of use cases.

  1. 1

    Swift Charts (Apple)

    Use This First

    Native iOS 16+ charting. Line, bar, area, scatter, pie, heatmap. Declarative API matching SwiftUI patterns. Free, no dependency.

    Pros
    • Native
    • Theme-aware
    • Accessibility built-in
    • Animations free
    Cons
    • iOS 16+ only
    • No candlestick
  2. 2

    Lightweight Charts (TradingView)

    Open-source financial charting. Candlestick, OHLC, volume, crosshairs, indicators. Built for trading apps. WebView-based but smooth.

    Pros
    • Best-in-class financial
    • Production-grade
    Cons
    • WebView dependency
    • Heavier
  3. 3

    DGCharts (DanielGindi)

    Successor to ChartsiOS. Mature, iOS 9+, every chart type. Use when you need iOS 15 / 16 fallback or specific advanced features.

    Pros
    • iOS 9+ support
    • Battle-tested
    Cons
    • Imperative API
    • Heavier than native
  4. 4

    SwiftUICharts (Will Dale)

    Open-source SwiftUI-native chart kit. Active before Swift Charts shipped. Now mostly superseded by Apple's framework.

    Cons
    • Maintenance has slowed
  5. 5

    Charts (legacy danielgindi/Charts)

    The original danielgindi/Charts library — now continued and renamed as DGCharts (#3 above). If you see "Charts" in old tutorials, use DGCharts instead; they are the same lineage.

    Cons
    • Old name — use DGCharts
  6. 6

    Plotly iOS Wrapper

    WebView wrapper around Plotly.js. Useful only if you already use Plotly in a web product and want consistent rendering.

    Cons
    • WebView dependency
    • Slow

Frequently Asked Questions

What's the best SwiftUI charts library in 2026?
Apple's native Swift Charts (iOS 16+) is the right default for almost every iOS app in 2026. It handles line, bar, area, scatter, and pie charts with native accessibility, animations, and theming. Use a third-party library only if you need iOS 15 support, advanced financial chart types (candlestick, OHLC), or hyper-custom rendering.
Is Apple's Swift Charts free?
Yes. Swift Charts is part of the iOS SDK — no package install, no license fee. Import Charts and use the Chart view.
Does Swift Charts support real-time updating data?
Yes. Charts re-render when bound to @State / @Observable data. Animations interpolate automatically. For high-frequency updates (>30Hz), debounce updates to avoid jank.
What about candlestick / OHLC charts for finance apps?
Swift Charts doesn't ship candlestick natively (as of iOS 18). Use BarMark with the [low, high] range and overlay another BarMark for [open, close]. For production financial charts with crosshairs and gestures, consider Lightweight Charts (open-source from TradingView).
Can Swift Charts render large datasets (10k+ points)?
Yes, with downsampling. Aggregate to ~500 visible points; Swift Charts handles that comfortably. For 100k+ raw points without aggregation, expect frame drops — preprocess server-side or in a background task.
How does The Swift Kit use charts?
The Swift Kit ships Swift Charts examples for: subscription revenue, user growth, habit-tracker progress, and AI-token usage. Each chart is themed via the design system, so colors and surface styles flow from your DesignSystem.swift.
Should I use Swift Charts or a third-party library?
Use Apple's native Swift Charts unless you have a specific reason not to. It is free, accessible, theme-aware, and matches SwiftUI patterns. Reach for a third-party library only for iOS 15 support (DGCharts), financial chart types like candlestick (Lightweight Charts), or rendering Apple does not offer.
What is the difference between DGCharts and the old Charts library?
They are the same project. The popular danielgindi/Charts library was renamed to DGCharts — "Charts" is the old name you will still see in older tutorials. For any new work, add DGCharts; it is the maintained continuation of the same library.
Does Swift Charts work on iOS 15?
No. Apple's Swift Charts requires iOS 16 or later. If you must support iOS 15 or earlier, use DGCharts (iOS 9+) or another third-party library until you can raise your deployment target.

Keep exploring

Ship your iOS app 10× faster

The Swift Kit gives you a production-ready SwiftUI boilerplate — design system, paywall, auth, AI, all pre-wired. $99 one-time.

Get The Swift Kit — $99

One-time purchase · Lifetime updates · 14-day refund