SwiftSunburstDiagram: a SwiftUI sunburst chart you configure with a tree of nodes
SwiftUI library to easily render diagrams given a tree of objects. Similar to ring chart, sunburst chart, multilevel pie chart.
At a glance
- What is it?
- SunburstDiagram is a SwiftUI library that renders a ring, sunburst, or multilevel pie chart from a tree of node objects, with animated updates, selectable and focusable nodes, and configurable rings. The toolchain requirements are current, but the README's own todo list shows several public behaviours that are not implemented yet.
- Who is it for?
- SunburstDiagram fits a SwiftUI team that needs a hierarchical breakdown chart, a ring chart, or a multilevel pie chart, and that wants the whole thing driven by a value-type configuration rather than by hand-built drawing code.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 11 days ago.
- What is it written in?
- Mainly Swift, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The chart is configured with a tree, not with drawing calls
SunburstDiagram is a library written with SwiftUI to easily render diagrams given a tree of objects, similar to a ring chart, a sunburst chart, or a multilevel pie chart. The configuration model is the whole API surface. You build a `SunburstConfiguration` holding an array of `Node` values, each with a name, an optional value, an optional color, and an optional array of children, and you hand that configuration to a view. The features list is organised around that model. You configure it with a tree of node objects, nodes have an optional label displayed as an image and text, you can optionally configure nodes with a value using four different rendering modes, and there is support for an infinite number of layers, meaning circles. The user is a SwiftUI developer who wants a hierarchical chart quickly, and the value is that the layout maths is someone else's problem.
The demo in the README is the whole API in twenty lines
The Usage section shows a complete view, and it is short enough to read as the reference:
import SwiftUI
import SunburstDiagram
struct ContentView: View {
// Create your configuration model
@StateObject private var configuration = SunburstConfiguration(nodes: [
Node(name: "Walking", value: 10.0, backgroundColor: .system(.blue)),
Node(name: "Restaurant", value: 30.0, backgroundColor: .system(.red), children: [
Node(name: "Dessert", image: .asset(name: "croissant"), value: 6.0),
Node(name: "Dinner", image: .asset(name: "poultry"), value: 10.0),
]),
Node(name: "Transport", value: 10.0, backgroundColor: .system(.purple)),
Node(name: "Home", value: 50.0, backgroundColor: .system(.teal)),
])
// Use directly in SwiftUI
var body: some View {
SunburstView(configuration: configuration)
}
}Two details are worth pulling out. The configuration is a `@StateObject`, so it is an observable object that can be mutated and the chart will follow. And if you are not in SwiftUI, the README says to embed in UIKit by wrapping `SunburstView` in a `UIHostingController`, which is the standard route for using a SwiftUI view in an existing UIKit navigation stack.
Colours and images go through reference types, not platform types
There is a design decision here that will matter to anyone building a shared model layer. The README says `Node` uses lightweight references instead of platform types. The image references are `ImageRef.asset(name:)` and `ImageRef.systemSymbol(name:)`, and the colour references are `ColorRef.system(_)`, `ColorRef.asset(name:)`, `ColorRef.rgba(...)`, and `ColorRef.dynamic(light:dark:)`. The reason is that the same configuration has to work on every platform the package targets, and the package targets iOS, macOS, tvOS, and watchOS. A plain `Color` or `Image` in a shared model would drag platform types into the model layer, and the dynamic light and dark variant has no equivalent on tvOS or watchOS. The `ColorRef` indirection keeps the model portable and makes dark mode a property of the reference rather than a global setting.
Focus and selection are the features that turn a chart into a control
Beyond the drawing, the feature list has three entries that make the chart interactive. You can select a node and focus on a node to see more details, or disable selection entirely. There is an option for a maximum number of rings to display, described as like a window moving as you focus on nodes, which is the standard focus-plus-context behaviour for hierarchical charts. And you can collapse arcs beyond a certain layer, so that you show more layers with less data, which is how a dense tree stays readable. Combined with reactive UI with animated updates, the effect is a chart that behaves like a small navigation widget rather than a static image.
Arc geometry is configurable, and that is where the polish stops
The geometry options are listed as the option to configure margin, size, sort and initial positions of arcs. Sort is the one that matters most in practice, because a sunburst chart with unordered siblings looks random, and initial positions decide where a user's eye lands first. The reason the chart still feels unfinished is in the Todo section, which lists framework work that has not been done. There is no option for a minimum arc percentage, with the note that if less, show data grouped in other. Arc colors are not computed if no color is provided by nodes, so a node with no color gets nothing. There is no option to show unassigned if the total of the arcs is less than 100%, and no rounded corners option for arcs with margins. Each of those is a small thing, and together they are the difference between a chart that looks designed and one that looks generated.
Installing it through SPM or CocoaPods, and the version floor is high
Installation is through the Swift Package Manager or CocoaPods, and there is a manual route too. For SPM, once your package is set up, adding SunburstDiagram as a dependency is as easy as adding it to the dependencies value of your `Package.swift`:
dependencies: [
.package(url: "https://github.com/lludo/SwiftSunburstDiagram.git", from: "1.5.1")
]For CocoaPods, the README asks you to specify it in your `Podfile`:
pod 'SunburstDiagram', '~> 1.5.1'The requirements section is worth reading twice. The library targets modern SwiftUI on iOS, macOS, tvOS, and watchOS, and it requires Swift 6.2 and Xcode 17 or newer, with the platform list given as iOS 26.0, macOS 26.0, tvOS 26.0, and watchOS 26.0. Those are recent operating system floors, so if your app still supports older systems the package is not for you as it stands.
Where SwiftSunburstDiagram is the wrong tool
Two limits are structural. The first is that the chart is a diagram, not a data visualisation engine. There is no axis, no legend, no tooltip, and no accessibility layer described, and the interaction model is limited to selection and focus on nodes. If your data needs a proper chart with a scale, tooltips, and a way for a screen reader user to read the values, you will be building that yourself around the view, and the todo list does not mention it. The second is the platform floor. Requiring iOS 26 and macOS 26 with Xcode 17 and Swift 6.2 rules out the majority of shipping apps today, and the README also admits that some public API features are still TODO. The project is a well-executed rendering component for a specific configuration style, and it is best used as a building block in an app that already targets the newest Apple platforms.
Editorial conclusion
SunburstDiagram fits a SwiftUI team that needs a hierarchical breakdown chart, a ring chart, or a multilevel pie chart, and that wants the whole thing driven by a value-type configuration rather than by hand-built drawing code. It is the wrong choice if you need the chart to look a certain way out of the box, because arcs are plain filled shapes and the todo list includes an option to add rounded corners for arcs with margins, and an option to show unassigned when the total of the arcs is under 100%. Before you adopt it, read the Todo section in the README, since it names the specific behaviours that are not there yet, and confirm your toolchain matches the stated requirements of Xcode 17 and Swift 6.2, since the package version and the required Xcode version are close together in the same file.
Frequently asked questions
What is SunburstDiagram and what can it render?
It is a SwiftUI library to easily render diagrams given a tree of objects, similar to a ring chart, a sunburst chart, or a multilevel pie chart. You configure it with a tree of node objects and render it by passing a SunburstConfiguration to SunburstView.
How do I install SwiftSunburstDiagram in an Xcode project?
Through Swift Package Manager by adding `.package(url: "https://github.com/lludo/SwiftSunburstDiagram.git", from: "1.5.1")` to the dependencies of your `Package.swift`, or through CocoaPods with `pod 'SunburstDiagram', '~> 1.5.1'` in your `Podfile`. A manual integration is also possible.
Which platforms and toolchain does SwiftSunburstDiagram support?
It targets modern SwiftUI on iOS, macOS, tvOS, and watchOS, and requires Swift 6.2 and Xcode 17 or newer, with the platform requirements given as iOS 26.0, macOS 26.0, tvOS 26.0, and watchOS 26.0.
How do I use a SunburstDiagram view in a UIKit app?
The README says to wrap `SunburstView` in a `UIHostingController`. In SwiftUI, you create a `SunburstConfiguration` with your nodes, hold it as a `@StateObject`, and pass it to `SunburstView` in your view body.
What features of SwiftSunburstDiagram are not implemented yet?
The README's todo list includes an option for a minimum arc percentage, computing arc colors when no color is provided by nodes, an option to show unassigned when the total of arcs is under 100%, an option for rounded corners on arcs with margins, and revisiting sendability and concurrency warnings with an explicit ownership and actor isolation plan.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/lludo-swiftsunburstdiagram)Was this useful?