Skip to content

Setting destination to nil shows empty screen with "Back"-button, works only once #91

Closed Answered by mbrandonw
appfrosch asked this question in Q&A
Discussion options

You must be logged in to vote

This is a bug in SwiftUI and something we discussed in episode 217 (at 23:39). If you simply nil out state driving a navigationDestination it will not pop the screen off the stack. Typically you can work around by adding @Environment(\.dismiss) to the child view, but that won't work directly for you since you are doing this directly in the navigationDestination content closure.

In order to make use of the hack workaround I think you need to wrap VocabularyAddEditView+toolbars in a little view so that you get access to @Environment(\.dismiss) for just that child view, and then invoke dismiss() when you write nil to the state.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by appfrosch
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
apple bug Something isn't working due to a bug on Apple's platforms.
2 participants
Converted from issue

This discussion was converted from issue #90 on March 14, 2023 17:30.