I started to encounter this error in Xcode 12 Beta 3, only for my Release build..
Have you managed to solve this?
Post
Replies
Boosts
Views
Activity
I have had this problem since beta 3, only when building with Release configuration. When building for Debug the widget runs as expected. I was hoping for a fix in beta 4 but the problem seems to persist.
I found this post by a SwiftUI engineer describing the issue, what's causing it and how to fix it.
https://hachyderm.io/@teissler/112533860374716961
Basically, if the view in the navigationDestination references any property in the presenting view, it will capture self and all its properties.
This is a problem if you have environment values that are not Equatable (like \.dismiss) and will cause a SwiftUI cycle that freezes the app.
The solution is to use a capture list in the navigationDestination closure to only capture the properties that are needed to construct the presented view. Also, if you have custom environment values, make them Equatable whenever possible to avoid this issue.