AttributeGraph: cycle detected Warning with WatchOS app

I've been seeing warning like the following with my Apple Watch app:

=== AttributeGraph: cycle detected through attribute 140952 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===

I've done some debugging with Instruments and Xcode, I've determined that its caused by adding a

.toolbar {
            ToolbarItemGroup(placement: .topBarTrailing) {
                Label("Stop", systemImage: "xmark")
            }
        }

to an item within my NavigationSplitView List Destination view.

To aid reproduction of this issue even more, I've verified the same warning occurs with the Apple sample code from the WWDC23 Backyard Birds app.

https://developer.apple.com/documentation/swiftui/backyard-birds-sample?changes=_9

If you take the Apple sample code, open it in Xcode 15.4 and run it in the Apple Watch WatchOS 10.5 simulator, then select the Bird Springs item, all is well.

If you then add the above toolbar code to the BackyardSummaryTab file at the bottom of the VStack, you'll see the same AttributeGraph issues I'm seeing in my app.

Is this a bug? I can't understand why adding a static ToolBarItem in WatchOS is causing this.

I've seen this issue in the simulator and also on device.

Answered by Frameworks Engineer in 791443022

Hi Simon! Yep, that's a bug. If you've filed Feedback for this issue, please let us know the number so we can verify it's a duplicate of the issue I'm thinking of. (There's always a chance it might be something else, in which case we'd investigate it separately based on your logs.) Thanks for the report!

Hi Simon! Yep, that's a bug. If you've filed Feedback for this issue, please let us know the number so we can verify it's a duplicate of the issue I'm thinking of. (There's always a chance it might be something else, in which case we'd investigate it separately based on your logs.) Thanks for the report!

AttributeGraph: cycle detected Warning with WatchOS app
 
 
Q