Post

Replies

Boosts

Views

Activity

Reply to SwiftData: Inserting two entities with same relationship target crashes
'Illegal attempt to establish a relationship 'events' between objects in different contexts" Is the clue here. let selectedEvents = events.filter({ $0.isSelected }) let note = Note(newNoteContent, events: selectedEvents) You need to fetch the "events" data using the same context that you are using to insert the Note
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’25