David Bureš on Nostr: Hey guys, a quick question about SwiftData. I have two models, SavedTrip and ...
Hey guys, a quick question about SwiftData.
I have two models, SavedTrip and SavedPlace. I’m trying to create a relationship between them, in which SavedTrip contains an optional array of SavedPlaces. However, I’m getting a crash when a SavedTrip has no SavedPlaces (this should be possible, since I marked SavedPlace as optional).
What am I doing wrong?
I’d appreciate any help. I’ll just be going to sleep now, since it’s 1AM here, so I’ll look at the responses tomorrow.
Thanks!
Published at
2023-07-05 23:15:59Event JSON
{
"id": "0efb6691b349a80241208392b14d6fbf54b3a04b0627a69b0d6cc2f83bbf335c",
"pubkey": "17ca545e6a302644a7898dc6862e512bb987c80b13d07bf3f5c2448e24db9b5f",
"created_at": 1688598959,
"kind": 1,
"tags": [
[
"mostr",
"https://mstdn.social/users/davidbures/statuses/110664021397452002"
]
],
"content": "Hey guys, a quick question about SwiftData.\n\nI have two models, SavedTrip and SavedPlace. I’m trying to create a relationship between them, in which SavedTrip contains an optional array of SavedPlaces. However, I’m getting a crash when a SavedTrip has no SavedPlaces (this should be possible, since I marked SavedPlace as optional).\n\nWhat am I doing wrong?\n\nI’d appreciate any help. I’ll just be going to sleep now, since it’s 1AM here, so I’ll look at the responses tomorrow.\n\nThanks!\n\nhttps://media.mstdn.social/media_attachments/files/110/664/021/030/919/101/original/0d46de6fdaf8a8ba.jpeg\n\nhttps://media.mstdn.social/media_attachments/files/110/664/021/177/847/848/original/fb408e9ef2df965c.jpeg",
"sig": "e10dd8e7cf9ce0795ab1970b1d167cf49d8e4099932bce5fb7a57e905fc00920b1b0ded2369786f26b1c1ee4d2ed028cd3a2b1dba4a70f65abe9d8aa2cc59951"
}