This project demonstrates an issue with SwiftData where one-to-one relationships are not properly nullified when the recieving entity is deleted.
Tested on an iPhone 17 simulator running iOS 26.0 with Xcode 26.0.1
- Run the app.
- Tap the "Sample" button to insert test data.
- You will see a single item named "Steve" and a zombie named "Steve's Zombie". Notice how the row item for Steve also displays the zombie attached to it.
- Tap on Steve and notice how his zombie is selected in the detail view picker.
- Navigate back and swipe left on the zombie to delete it and notice how the indicator for Steve's zombie does not update.
- Tap the print button and inspect the values in the debug log. Notice how Steve still has his zombie attached to it even though it was just deleted and appears as such in the log and UI.
- Tap on Steve and notice how the zombie picker reflects the proper value.
- Navigate back and repeat step 5, noticing how the issue still persists even though the picker reflected the proper value.