SwiftUI View Stops Updating When Using @Environment - Xcode 26

Hi all - i'm encountering a strange issue since updating to Xcode 26.0.1.

It seems that any SwiftUI Views that have an :ObservedObject property that contains @Published properties, and use those properties inside the View, no longer update when those properties are updated when the view also has an @Environment property.

If I remove the @Environment property and any usage of it, the view updates correctly. The specific environment property i'm using is .safeAreaInsets, like so:

@Environment(\.safeAreaInsets) private var safeAreaInsets

Is this a recognised bug in the latest iOS 26 SDK?

Thanks

Answered by DTS Engineer in 860554022

We recommend you use the Observable macro instead. Please review Migrating from the Observable Object protocol to the Observable macro and apply the changes to your project.

If you’re able to reproduce the issue using the Observable macro, please share a link to a sample project that reproduces the issue.

We recommend you use the Observable macro instead. Please review Migrating from the Observable Object protocol to the Observable macro and apply the changes to your project.

If you’re able to reproduce the issue using the Observable macro, please share a link to a sample project that reproduces the issue.

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.

SwiftUI View Stops Updating When Using @Environment - Xcode 26
 
 
Q