SwiftUI 的 Self._printChanges() 定义 and/or 记录在哪里?

Where is Self._printChanges() defined and/or documented for SwiftUI?

我看过一些关于 iOS 15 的新 Self._printChanges() 功能的文章或视频,但在任何地方都找不到有关它的任何文档。有谁知道苹果在哪里记录了这个新功能?如何使用它是很明显的,但我想看看我们能用它做些什么,更多地了解它会有所帮助。即使 Xcode 的查找也没有任何结果。有人找到什么了吗?

不幸的是,_printChanges() 是私有的 API,这就是它没有记录的原因。如此多的视频和文章引用它的唯一原因是因为一位 Apple 工程师在 WWDC21 期间提到了它。他们是这样说的:

It's not technically API-notice the leading underscore — so should only be used in debugging. My one sentence pro-tip is the extent of the docs I'm afraid.

但是,当您 Option + 单击时,Xcode 会显示摘要。

Summary
When called within an invocation of body of a view of this type, prints the names of the changed dynamic properties that caused the result of body to need to be refreshed. As well as the physical property names, “@self” is used to mark that the view value itself has changed, and “@identity” to mark that the identity of the view has changed (i.e. that the persistent data associated with the view has been recycled for a new instance of the same type).