On a MacBook Air M4 running macOS Sequoia 15.7.7, the following tiny code does warn inside the Xcode 26.3.
Here is the whole console output:
=== AttributeGraph: cycle detected through attribute 109592 ===
=== AttributeGraph: cycle detected through attribute 109592 ===
=== AttributeGraph: cycle detected through attribute 110216 ===
=== AttributeGraph: cycle detected through attribute 110216 ===
=== AttributeGraph: cycle detected through attribute 110284 ===
=== AttributeGraph: cycle detected through attribute 110284 ===
=== AttributeGraph: cycle detected through attribute 110216 ===
=== AttributeGraph: cycle detected through attribute 109592 ===
=== AttributeGraph: cycle detected through attribute 109592 ===
=== AttributeGraph: cycle detected through attribute 110216 ===
Here is the full code:
import SwiftUI
@main
struct myApp: App {
var body: some Scene {
WindowGroup {
BaseView()
}
}
}
struct BaseView: View {
@State private var isWorking: Bool = false
var body: some View {
Button("Go") {
Task {
// AttributeGraph warnings
await MainActor.run { isWorking = true }
await MainActor.run { isWorking = false }
// No warnings at all
// DispatchQueue.main.async { isWorking = true }
// DispatchQueue.main.async { isWorking = false }
}
}
.disabled(isWorking)
.padding()
}
}
You can see with DispatchQueue.main.async {...}, warnings aren't there.
After a few days struggling with different AI support (Claude, ChatGPT, Perplexity), I didn't find any way to fix my own code. This tiny code is just there to show the issue.
I tested multiple workarounds without finding one that fits to my app context.
Thanks in advance for your support.
Topic:
UI Frameworks
SubTopic:
SwiftUI
4
0
222