-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Moving embedded objects through the offset API crashes. Here's a simple reproduction case:
func testEmbeddedListMove() { let parentObject = EmbeddedParentObject() for _ in 0..<3 { parentObject.array.append(EmbeddedTreeObject1()) } // unmanaged is OK parentObject.array.move(fromOffsets: IndexSet([0]), toOffset: 1) let realm = inMemoryRealm("swiftui-tests") try! realm.write { realm.add(parentObject) } try! realm.write { // standard move with managed is ok parentObject.array.move(from: 0, to: 1) } try! realm.write { // offset move with managed is not ok, Cannot add an existing managed embedded object to a List, this will crash parentObject.array.move(fromOffsets: IndexSet([0]), toOffset: 1) } }