I am using Core Data in my app and am dealing with a many to many relationship between two entities.
My goal is to have the user select which of one entity will be related to another entity by using a tableview and having the user select cells.
When the Class for the Entity is created, "Lists" is set as type NSSet which makes sense since it doesn't need to be ordered, and I don't want more than one of any other entity in there.
My problem comes when I want to add items to an NSSet, I cannot do it as far as I know without using a NSMutableSet. Then I gain
simply create a mutable copy:
var set = NSSet(objects: "One", "Two", "Three") let mutableSet = set.mutableCopy() as! NSMutableSet mutableSet.addObject("Four") set = mutableSet