Can confirm I am having the same issue, even after installing the latest XCode update today (Version 15.2 (15C500b)).
iOS 17.2.1.
Warnings are logged with both the simulator and my iPhone 13 mini (17.2.1).
Removing all references to focusState does not fix.
Post
Replies
Boosts
Views
Activity
I am also experiencing the same issue with iOS 17.2 and XCode 15.
Also wondering about this. Because in my app the order is important, and I give users the option to reorder the items.
Sorting after the fact with a computed property is fine for display, but this is much more of a headache when trying to persist an ordering change.
I came up with the most elegant workaround I could and posted it as a small sample app here:
https://github.com/hekuli/swiftdata-test
The gist is that I make the model's array private, and have a corresponding public computed property that always sorts the array when accessed. I also use a Factory pattern for higher-level orchestration to manipulate the models b/c I encountered too many SwiftData crashes if model operations were not performed in exact order it likes.
I'm still not sure if this is the best approach, so I'd love to hear any suggestions on how it could be improved.
I am having the same issue. I cannot find FB12287778 in the Feedback tool.
Are there any workarounds?
I'm having the exact same issue. Did you ever find a working solution?
Also not working for me either, even with XCode 16 beta 3.
Manual testing with transaction manager works as expected, but automated testing with SKTest does not work as expected :/
How is this still broken?
FB15119244
Same with iOS 17.0
Thank you all for posting this and the solution. This is literally the only resource about this on the internet. It helped me with a resolution.
My app was working fine for iOS 17, but for iOS 18 would silently fail with the mentioned error b/c I didn't explicitly define the relationships and set the corresponding objects before insertion.
I really can't believe Apple just made breaking changes to SwiftData, a supposedly stable framework, without any communication or documentation thereof. Very unprofessional. Never again will I be an early adopter of any of Apple's developer technologies.
Probably the same thing described here:
https://forums.developer.apple.com/forums/thread/762679?page=1#809681022