My issue is very similar to what @emovla mentioned. My app freezes when these 2 conditions meet:
There's this dismiss @Environment(\.dismiss) private var dismiss together with the .navigationDestination() on the same view.
The destination view has either @State or @Binding for an @Observable object. For example: @State private var form = RequestForm()
If either of these conditions is not met, there's no problem. It means I can resolve this by either:
Removing the dismiss function
Or removing the state on the destination view (or alternatively, make the state variable optional and initialize on onAppear)
I went with the 1st option of removing the dismiss function, and used a simple binding value to dismiss the view.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: