I'm running into an issue where my application will hang when switching tabs. The issue only seems to occur when I include a Swift Chart in a navigation label. The application does not hang If I replace the chart with a text field.
This appears to only hang when running on macOS 26. When running on iOS (simulator) or visionOS (simulator, on-device) I do not observe a hang. The same code does not hang on macOS 15.
Has any one seen this behavior?
The use case is that my root view is a TabView where the first tab is a summary of events that have occurred. This summary is embedded in a NavigationStack and has a graph of events over the last week. I want the user to be able to click that graph to get additional information regarding the events (ie: a detail page or break down of events).
Initially, the summary view loads fine and displays appropriately. However, when I switch to a different tab, the application will hang when I switch back to the summary view tab.
In Xcode I see the following messages
=== AttributeGraph: cycle detected through attribute 162104 ===
=== AttributeGraph: cycle detected through attribute 162104 ===
=== AttributeGraph: cycle detected through attribute 162104 ===
=== AttributeGraph: cycle detected through attribute 162104 ===
=== AttributeGraph: cycle detected through attribute 162104 ===
A simple repro is the following
import SwiftUI
import Charts
@main
struct chart_cycle_reproApp: App {
var body: some Scene {
WindowGroup {
TabView {
Tab("Chart", systemImage: "chart.bar") {
NavigationStack {
NavigationLink {
Text("this is an example of clicking the chart")
}
label: {
Chart {
BarMark(
x: .value("date", "09/03"),
y: .value("birds", 3)
)
// additional marks trimmed
}
.frame(minHeight: 200, maxHeight: .infinity)
}
}
}
Tab("List", systemImage: "list.bullet") {
Text("This is an example")
}
}
}
}
}