I\'ve been trying to get my head around adding objects in relationships using CoreData and Swift. I am at a loss, I do not understand why my code does not work. I am trying to a
If you use the objective C generated NSManagedObject subclasses, they include custom methods for adding a single object - I think these are tried and tested and seem better than what is currently there for swift.
Theoretically you would just need to just set the new set with whatever new set you created. One option would be:
var matchobjs = matches.allObjects as [Event]
matchobjs.append(event)
matches = NSSet(array: matchobjs)
However the error looks very similar to this post:
Which to me looks like theres something fishy going on again with many-to-many relationships...