Post

Replies

Boosts

Views

Activity

Reply to SwiftUI View Stops Updating When Using @Environment - Xcode 26
Unfortunately we can't easily migrate to the Observable macro without a large amount of changes as most of our ObservableObjects use Combine to observe published properties and this doesn't seem to be supported with the macro. However, I have managed to resolve this another way after trying to reproduce the issue as simply as possible. It turns out that if the SwiftUI.View is wrapped in a UIHostingController, and that UIHostingController overrides the viewWillAppear method to hide the navigation bar like: override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.setNavigationBarHidden(navBarHidden, animated: false) } , this issue would be present. Removing this override and using viewDidLayoutSubviews() instead somehow solves the issue.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25