Post

Replies

Boosts

Views

Activity

Reply to SwiftUI NavigationLink freezing when tapped
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.
Jul ’24