Post

Replies

Boosts

Views

Activity

View crashes/disappears if root of NavigationViews links to view with @ViewBuilder property?
Hi, I have just found the weirdest behaviour in SwiftUI. Here is what happens: I have a view A which contains a NavigationView. From A the user can go to view B and from there to view C. In view C the user can enter data which updates a published property of an observable object to which views A, B and C link to via @Observed Object. On updating the published property view c just disappears, without any crash report, log message or anything (And the reason why I think it crashes is because the usual animation for going forward/backward is missing when it disappears). The app doesn't crash either and can be used normally, including going back to view C. If I remove the link to the observed object in view A OR if I remove some code from view A and put it into a separate view, then view C does not disappear when the published property is updated. The code I remove from view A uses another view which has a @ViewBuilder property. Removing the @ViewBuilder property also prevents the crash. Again, there is no crash report or anything. I don't have the time to produce non-NDA code for demonstration purposes, but has someone ever seen something like this? Best, Philip
0
0
515
Mar ’22