Debugging SwiftUI

To print why a view is being rebuilt, use Self._printChanges(). You can add it as a line of code in the body property like this:

let _ = Self._printChanges()

(Remember you now need to explicitly return the computed view.)

You can also add it as a debugger breakpoint withoit modifying code:

The output is something like:

DanceStack: @self, @identity, _vm, _compact changed.
() $R6 = {}

(The register dump can be ignored.)