iOS 15 Navigation broken with SwiftUI, Combine, and Realm

I have an app that uses Realm as a data storage solution and Combine as a declarative framework.

Ever since I upgraded to iOS 15, my app has become unusable because of what looks like a navigation bug. It works fine with iOS 14.

The gist of what I believe the bug is, is that when I navigate to a child view and the parent view is updated, the navigation jumps back to the parent view instead of staying in the child view (https://www.youtube.com/watch?v=c-PAPy-RCqg)

So in my example, ContentView loads data Realm and creates a list of DetailViews to display the data. When the DetailView is displayed, it writes some back to the Realm table.

I have a sample app demonstrating the problem here: https://github.com/skywalkerdude/navsample. Since it is using Cocoapods, make sure you open NavSample.xcworkspace and not NavSample.xcodeproj.

The solution was to set an id field in the List:

List(viewModel.details, id: /.self) { ... }

Accepted Answer

The solution was to set an id field in the List:

List(viewModel.details, id: /.self) { ... }

iOS 15 Navigation broken with SwiftUI, Combine, and Realm
 
 
Q