Search code examples
xcodemacosdebuggingswiftui

How do I debug SwiftUI AttributeGraph cycle warnings?


I'm getting a lot of AttributeGraph cycle warnings in my app that uses SwiftUI. Is there any way to debug what's causing it?

This is what shows up in the console:

=== AttributeGraph: cycle detected through attribute 11640 ===
=== AttributeGraph: cycle detected through attribute 14168 ===
=== AttributeGraph: cycle detected through attribute 14168 ===
=== AttributeGraph: cycle detected through attribute 44568 ===
=== AttributeGraph: cycle detected through attribute 3608 ===

Solution

  • The log is generated by (from private AttributeGraph.framework)

    AG::Graph::print_cycle(unsigned int) const ()
    

    so you can set symbolic breakpoint for print_cycle

    demo

    and, well, how much it could be helpful depends on your scenario, but definitely you'll get error generated stack in Xcode.