|
Anyone know how SwiftData handles deletion of a Double Linked List? the problem I have is understanding the implied relationships and deletions when I delete a sidebar [modelContext.delete(sidebar)]. Sidebar should have a relationship to the head of the list, which then has a relationship to the next in the list, etc. Since I am not defining a "Cascade" then I don't know what happens. I have:
then:
|
|
Hi, Based on the testing i've done if you delete the
|
|
Thank you. By making the links, Next/Prev, computed properties, I would expect the behavior you demostrate. However, in my code, I did not, instead these are links. So, they are in fact one-to-one links which the documentation says will be delieted if cascade is used. Implying it would follow the list. I will do more testing. But, thank you, your code definitely works as expected. |
|
I'm not following, how are next and previous computed properties?, could you share some of your code? i'm very interested to see how you did it. |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.