TabView resets when Realm changes?

Hi guys,

having a really annoying issue right now. I have a SwiftUI TabView, with a selection, that gets reset if the realm changes. I made a tiny example:

import SwiftUI
import RealmSwift

class MyObject: Object, Identifiable {
    @Persisted var id = UUID().uuidString
    @Persisted var text:String = String("abcdefghijklmnopqrstuvwxyz".randomElement()!)
}

struct ContentView: View {
    let realm = try! Realm()
    @State var obj: MyObject? = nil
    @ObservedResults(MyObject.self) var items
    
    var body: some View {
        VStack {
            Text("Selected ID: \(obj?.text ?? "<none>")")
            Text("Add")
                .onTapGesture {
                    try! realm.write {
                        let o = MyObject()
                        realm.add(o)
                    }
                }
            if items.count > 0 {
                TabView(selection: $obj) {
                    ForEach(items, id: \.self) { t in
                        Text("\(t.text)")
                            .tag(t as MyObject?)
                    }
                }
                .tabViewStyle(.page(indexDisplayMode: .never))
            }
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(.orange)
    }
}

You can swipe right a few times, and then tap on “add”, which just adds another object to the collection. The TabView will reset to the first item of the list, while the selected object still is at the one you previously swiped to (see Text String at top).

This does not happen when using Integer for a selection, and work around this with setting IDs as tag etc., which can make things a lot more complex in other situations obviously.

Is there any way to avoid / conquer this behavior? I would REALLY like to avoid having to use Integers and Array-Indices here.

Thanks